pos-tagger

How to POS_TAG a french sentence?

冷暖自知 提交于 2019-12-03 04:47:08
I'm looking for a way to pos_tag a French sentence like the following code is used for English sentences: def pos_tagging(sentence): var = sentence exampleArray = [var] for item in exampleArray: tokenized = nltk.word_tokenize(item) tagged = nltk.pos_tag(tokenized) return tagged The NLTK doesn't come with pre-built resources for French. I recommend using the Stanford tagger , which comes with a trained French model. This code shows how you might set up the nltk for use with Stanford's French POS tagger. Note that the code is outdated (and for Python 2), but you could use it as a starting point.

Tagging a single word with the nltk pos tagger tags each letter instead of the word

谁说我不能喝 提交于 2019-12-01 20:10:29
问题 I'm try to tag a single word with the nltk pos tagger: word = "going" pos = nltk.pos_tag(word) print pos But the output is this: [('g', 'NN'), ('o', 'VBD'), ('i', 'PRP'), ('n', 'VBP'), ('g', 'JJ')] It's tagging each letter rather than just the one word. What can I do to make it tag the word? 回答1: nltk.tag.pos_tag accepts a list of tokens, separate and tags its elements. Therefore you need to put your words in an iterable like list: >>> nltk.tag.pos_tag(['going']) [('going', 'VBG')] 回答2: >>>

Tagging a single word with the nltk pos tagger tags each letter instead of the word

吃可爱长大的小学妹 提交于 2019-12-01 19:37:01
I'm try to tag a single word with the nltk pos tagger: word = "going" pos = nltk.pos_tag(word) print pos But the output is this: [('g', 'NN'), ('o', 'VBD'), ('i', 'PRP'), ('n', 'VBP'), ('g', 'JJ')] It's tagging each letter rather than just the one word. What can I do to make it tag the word? nltk.tag.pos_tag accepts a list of tokens, separate and tags its elements. Therefore you need to put your words in an iterable like list: >>> nltk.tag.pos_tag(['going']) [('going', 'VBG')] >>> word = 'going' >>> word = nltk.word_tokenize(word) >>> l1 = nltk.pos_tag(word) >>> l1 [('going', 'VBG')] The

How do I tag textfiles with hunpos in nltk?

血红的双手。 提交于 2019-12-01 14:30:48
Can someone help me with the syntax for hunpos tagging a corpus in nltk? What do I import for the hunpos.HunPosTagger module ? How do I HunPosTag the corpus? See the code below. import nltk from nltk.corpus import PlaintextCorpusReader from nltk.corpus.util import LazyCorpusLoader corpus_root = './' reader = PlaintextCorpusReader (corpus_root, '.*') ntuen = LazyCorpusLoader ('ntumultien', PlaintextCorpusReader, reader) ntuen.fileids() isinstance (ntuen, PlaintextCorpusReader) # So how do I hunpos tag `ntuen`? I can't get the following code to work. # please help me to correct my python syntax

nltk pos_tag usage

和自甴很熟 提交于 2019-12-01 03:46:46
I am trying to use speech tagging in NLTK and have used this command: >>> text = nltk.word_tokenize("And now for something completely different") >>> nltk.pos_tag(text) Traceback (most recent call last): File "<pyshell#4>", line 1, in <module> nltk.pos_tag(text) File "C:\Python27\lib\site-packages\nltk\tag\__init__.py", line 99, in pos_tag tagger = load(_POS_TAGGER) File "C:\Python27\lib\site-packages\nltk\data.py", line 605, in load resource_val = pickle.load(_open(resource_url)) File "C:\Python27\lib\site-packages\nltk\data.py", line 686, in _open return find(path).open() File "C:\Python27

nltk pos_tag usage

☆樱花仙子☆ 提交于 2019-12-01 00:54:50
问题 I am trying to use speech tagging in NLTK and have used this command: >>> text = nltk.word_tokenize("And now for something completely different") >>> nltk.pos_tag(text) Traceback (most recent call last): File "<pyshell#4>", line 1, in <module> nltk.pos_tag(text) File "C:\Python27\lib\site-packages\nltk\tag\__init__.py", line 99, in pos_tag tagger = load(_POS_TAGGER) File "C:\Python27\lib\site-packages\nltk\data.py", line 605, in load resource_val = pickle.load(_open(resource_url)) File "C:

Train model using Named entity

℡╲_俬逩灬. 提交于 2019-12-01 00:22:34
I am looking on standford corenlp using the Named Entity REcognizer.I have different kinds of input text and i need to tag it into my own Entity.So i started training my own model and it doesnt seems to be working. For eg: my input text string is "Book of 49 Magazine Articles on Toyota Land Cruiser 1956-1987 Gold Portfolio http://t.co/EqxmY1VmLg http://t.co/F0Vefuoj9Q " I go through the examples to train my own models and and look for only some words that I am interested in. My jane-austen-emma-ch1.tsv looks like this Toyota PERS Land Cruiser PERS From the above input text i am only interested

Train model using Named entity

☆樱花仙子☆ 提交于 2019-11-30 19:54:06
问题 I am looking on standford corenlp using the Named Entity REcognizer.I have different kinds of input text and i need to tag it into my own Entity.So i started training my own model and it doesnt seems to be working. For eg: my input text string is "Book of 49 Magazine Articles on Toyota Land Cruiser 1956-1987 Gold Portfolio http://t.co/EqxmY1VmLg http://t.co/F0Vefuoj9Q" I go through the examples to train my own models and and look for only some words that I am interested in. My jane-austen

Can't make Stanford POS tagger working in nltk

谁说我不能喝 提交于 2019-11-30 15:48:45
问题 I'm trying to work with Stanford POS tagger within NLTK. I'm using the example shown here: http://www.nltk.org/api/nltk.tag.html#module-nltk.tag.stanford I'm able to load everything smoothly: >>> import os >>> from nltk.tag import StanfordPOSTagger >>> os.environ['STANFORD_MODELS'] = '/path/to/stanford/folder/models') >>> st = StanfordPOSTagger('english-bidirectional-distsim.tagger',path_to_jar='/path/to/stanford/folder/stanford-postagger.jar') but at the first execution: >>> st.tag('What is

Can't make Stanford POS tagger working in nltk

半城伤御伤魂 提交于 2019-11-30 14:53:21
I'm trying to work with Stanford POS tagger within NLTK. I'm using the example shown here: http://www.nltk.org/api/nltk.tag.html#module-nltk.tag.stanford I'm able to load everything smoothly: >>> import os >>> from nltk.tag import StanfordPOSTagger >>> os.environ['STANFORD_MODELS'] = '/path/to/stanford/folder/models') >>> st = StanfordPOSTagger('english-bidirectional-distsim.tagger',path_to_jar='/path/to/stanford/folder/stanford-postagger.jar') but at the first execution: >>> st.tag('What is the airspeed of an unladen swallow ?'.split()) it gives me the following error: Loading default