本文整理匯總了Python中nltk.tag.stanford.StanfordNERTagger方法的典型用法代碼示例。如果您正苦於以下問題:Python stanford.StanfordNERTagger方法的具體用法?Python stanford.StanfordNERTagger怎麽用?Python stanford.StanfordNERTagger使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類nltk.tag.stanford
的用法示例。
在下文中一共展示了stanford.StanfordNERTagger方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from nltk.tag import stanford [as 別名]
# 或者: from nltk.tag.stanford import StanfordNERTagger [as 別名]
def __init__(self):#, ner_dir, pos_dir, ft_dir):
#MODELS_DIR, FASTTEXT_DIR, POS_DIR, NER_DIR, MUSIC_XML_DIR
FASTTEXT_DIR = "fastText"
MUSIC_DATABASE = "music_metadata.json"
self.snt = StanfordNERTagger('stanford-ner/voiceai-ner.ser.gz', 'models/../stanford-ner/stanford-ner.jar')
self.spt = StanfordPOSTagger('stanford-pos/voiceai_bi.tagger', 'models/../stanford-pos/stanford-postagger.jar')
# self.spt = StanfordPOSTagger('/run/media/vidur/Kachra/edu/stanford/nlp/models/pos-tagger/english-caseless-left3words-distsim.tagger', 'models/../stanford-pos/stanford-postagger.jar')
self.tyc = TypeClassifier("fastText/voiceai.bin", FASTTEXT_DIR+"/fasttext")#"fastText/voiceai.bin")
self.controls = []
self.controls.append(MusicControl(MUSIC_DATABASE))
self.controls.append(HardwareControl())
self.controls.append(ConversionControl())
self.qsc = QuestionControl()
self.my_name = "Halzee"
self.age = 16
self.creator = "Vidur"
示例2: getTheNamedEntities
# 需要導入模塊: from nltk.tag import stanford [as 別名]
# 或者: from nltk.tag.stanford import StanfordNERTagger [as 別名]
def getTheNamedEntities(text):
st = StanfordNERTagger(StanfordNERClassifierPath, StanfordNERjarPath)
lstTag = st.tag(text.split())
result = {}
for tag in lstTag:
#if str(tag[1]).lower() != 'o': #### CAUTION - DROPPING the General Term 'Object' items
result [str(str(tag[0])).replace('.','')] = str(tag[1])
return result
#Returns the expanded URL from links such as bit.ly
#[input: string] [output: string]
示例3: __init__
# 需要導入模塊: from nltk.tag import stanford [as 別名]
# 或者: from nltk.tag.stanford import StanfordNERTagger [as 別名]
def __init__(self, cs_model, transi_matrix, tags, local_config=None):
if local_config is None:
local_config = copy.deepcopy(CONFIGS)
self.cs_model = cs_model
self.transi_matrix = transi_matrix
self.tags = tags
self.local_config = local_config
self.lang1_tagger = StanfordNERTagger(local_config["lang1_class"],
local_config["class_jar"])
self.lang2_tagger = StanfordNERTagger(local_config["lang2_class"],
local_config["class_jar"])
示例4: getTheNamedEntities
# 需要導入模塊: from nltk.tag import stanford [as 別名]
# 或者: from nltk.tag.stanford import StanfordNERTagger [as 別名]
def getTheNamedEntities(text):
st = StanfordNERTagger('C:\Progs\stanfordNER\classifiers\english.all.3class.distsim.crf.ser.gz', 'C:\Progs\stanfordNER\stanford-ner.jar')
result = st.tag(text.split())
return result
#Returns the expanded URL from links such as bit.ly
#[input: string] [output: string]