當前位置: 首頁>>代碼示例>>Python>>正文


Python stanford.StanfordNERTagger方法代碼示例

本文整理匯總了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" 
開發者ID:vidursatija,項目名稱:voiceai,代碼行數:24,代碼來源:voiceai.py

示例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] 
開發者ID:N1h1l1sT,項目名稱:Data-Mining-From-Twitter,代碼行數:16,代碼來源:index.py

示例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"]) 
開發者ID:Bilingual-Annotation-Task-Force,項目名稱:python-tagger,代碼行數:13,代碼來源:evaluator.py

示例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] 
開發者ID:N1h1l1sT,項目名稱:Data-Mining-From-Twitter,代碼行數:10,代碼來源:Part2_functions.py


注:本文中的nltk.tag.stanford.StanfordNERTagger方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。