Description
This model extracts IPs using rule-based RegexMatcherInternal annotator.
Predicted Entities
How to use
documentAssembler = DocumentAssembler()\
.setInputCol("text")\
.setOutputCol("document")
ip_regex_matcher = RegexMatcherInternalModel.pretrained("ip_matcher","en","clinical/models") \
.setInputCols(["document"])\
.setOutputCol("IP")\
ip_regex_matcher_pipeline = Pipeline(
stages=[
documentAssembler,
ip_regex_matcher
])
data = spark.createDataFrame([
["""Name: ID: 1231511863, Driver's License No: A334455B, SSN: 324-59-8674. E-mail: hale@gmail.com.
Access the router at http://192.168.0.1 for configuration. Please connect to 10.0.0.1 to access the database..
Visit http://198.51.100.42 for more information. File transfers can be done via ftp://files.example.com.
"""]]).toDF("text")
result = ip_regex_matcher_pipeline.fit(data).transform(data)
val documentAssembler = new DocumentAssembler()
.setInputCol("text")
.setOutputCol("document")
val ip_regex_matcher = RegexMatcherInternalModel.pretrained("ip_matcher","en","clinical/models")
.setInputCols(Array("document"))
.setOutputCol("IP")
val regex_pipeline = new Pipeline().setStages(Array(
documentAssembler,
ip_regex_matcher
))
val data = Seq("""Name: ID: 1231511863, Driver's License No: A334455B, SSN: 324-59-8674. E-mail: hale@gmail.com.
Access the router at http://192.168.0.1 for configuration. Please connect to 10.0.0.1 to access the database..
Visit http://198.51.100.42 for more information. File transfers can be done via ftp://files.example.com.""").toDF("text")
val result = regex_pipeline.fit(data).transform(data)
Results
+-------------+-----+---+-----+
|chunk |begin|end|label|
+-------------+-----+---+-----+
|192.168.0.1 |131 |141|IP |
|10.0.0.1 |180 |187|IP |
|198.51.100.42|235 |247|IP |
+-------------+-----+---+-----+
Model Information
Model Name: | ip_matcher |
Compatibility: | Healthcare NLP 5.4.0+ |
License: | Licensed |
Edition: | Official |
Input Labels: | [document] |
Output Labels: | [IP] |
Language: | en |
Size: | 2.3 KB |
PREVIOUSEmail Regex Matcher