Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import BertTokenizer, AutoModelForTokenClassification
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
tokenizer = BertTokenizer.from_pretrained('bert-base-cased')
|
| 5 |
+
model = AutoModelForTokenClassification.from_pretrained("ctrlbuzz/bert-addresses")
|
| 6 |
+
nlp = pipeline("ner", model=model, tokenizer=tokenizer)
|
| 7 |
+
example = "While Maria was representing Johnson & Associates at a conference in Spain, she mailed me a letter from her new office at 123 Elm St., Apt. 4B, Springfield, IL.",
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
ner_results = nlp(example)
|
| 11 |
+
print(ner_results)
|