Skip to content

Latest commit

 

History

History
31 lines (19 loc) · 725 Bytes

ner.rst

File metadata and controls

31 lines (19 loc) · 725 Bytes

camel_tools.ner

camel_tools.ner

Classes

camel_tools.ner.NERecognizer

Examples

Below is an example of how to load and use the default pre-trained model.

from camel_tools.ner import NERecognizer

ner = NERecognizer.pretrained()

# Predict the labels of a single sentence.
# The sentence must be pretokenized by whitespace and punctuation.
sentence = 'إمارة أبوظبي هي إحدى إمارات دولة الإمارات العربية المتحدة السبع .'.split()
labels = ner.predict_sentence(sentence)

# Print the list of token-label pairs
print(list(zip(sentence, labels)))