Skip to content

Instantly share code, notes, and snippets.

@mmsamiei
Created August 7, 2019 21:30
Show Gist options
  • Save mmsamiei/c63f90a22fa4acdbe89f331c7ce3ccc0 to your computer and use it in GitHub Desktop.
Save mmsamiei/c63f90a22fa4acdbe89f331c7ce3ccc0 to your computer and use it in GitHub Desktop.
!pip install stanfordnlp
import stanfordnlp
stanfordnlp.download('fa')
nlp = stanfordnlp.Pipeline(processors = "tokenize", lang="fa", models_dir=".")
str = "برای رفتن به سمرقند باید از خان‌های بی‌شمار گذشت"
doc = nlp(str)
for sent in doc.sentences:
for wrd in sent.words:
print(wrd.text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment