from polyglot.downloader import downloader
print(downloader.supported_languages_table("pos2"))

"""
Explanation: Part of Speech Tagging
Part of speech tagging task aims to assign every word/token in plain text a category that identifies the syntactic functionality of the word occurrence.
Polyglot recognizes 17 parts of speech, this set is called the universal part of speech tag set:

ADJ: adjective
ADP: adposition
ADV: adverb
AUX: auxiliary verb
CONJ: coordinating conjunction
DET: determiner
INTJ: interjection
NOUN: noun
NUM: numeral
PART: particle
PRON: pronoun
PROPN: proper noun
PUNCT: punctuation
SCONJ: subordinating conjunction
SYM: symbol
VERB: verb
X: other

Languages Coverage
The models were trained on a combination of:


Original CONLL datasets after the tags were converted using the universal POS tables.


Universal Dependencies 1.0 corpora whenever they are available.
End of explanation
"""


%%bash
polyglot download embeddings2.en pos2.en

"""
Explanation: Download Necessary Models
End of explanation
"""


from polyglot.text import Text

blob = """We will meet at eight o'clock on Thursday morning."""
text = Text(blob)

# We can also specify language of that text by using
# text = Text(blob, hint_language_code='en')

"""
Explanation: Example
We tag each word in the text with one part of speech.
End of explanation
"""


text.pos_tags

"""
Explanation: We can query all the tagged words
End of explanation
"""


text.words[0].pos_tag

"""
Explanation: After calling the pos_tags property once, the words objects will carry the POS tags.
End of explanation
"""


!polyglot --lang en tokenize --input testdata/cricket.txt |  polyglot --lang en pos | tail -n 30

"""
Explanation: Command Line Interface
End of explanation
"""


