本文整理汇总了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]