Skip to main content

Dependency-parser for Thai language

Project description

Current PyPI packages

spaCy-Thai

Tokenizer, POS-tagger, and dependency-parser for Thai language, working on Universal Dependencies.

Basic Usage

>>> import spacy_thai
>>> nlp=spacy_thai.load()
>>> doc=nlp("แผนกนี้กำลังเผชิญกับความท้าทายใหม่")
>>> for t in doc:
...   print("\t".join([str(t.i+1),t.orth_,t.lemma_,t.pos_,t.tag_,"_",str(0 if t.head==t else t.head.i+1),t.dep_,"_","_" if t.whitespace_ else "SpaceAfter=No"]))
...
1	แผนก	แผนก	NOUN	NCMN	_	4	nsubj	_	SpaceAfter=No
2	นี้	นี้	DET	DDAC	_	1	det	_	SpaceAfter=No
3	กำลัง	กำลัง	AUX	XVBM	_	4	aux	_	SpaceAfter=No
4	เผชิญ	เผชิญ	VERB	VSTA	_	0	ROOT	_	SpaceAfter=No
5	กับ	กับ	ADP	RPRE	_	6	case	_	SpaceAfter=No
6	ความ	ความ	PART	FIXN	_	4	obl	_	SpaceAfter=No
7	ท้าทาย	ท้าทาย	VERB	VACT	_	6	acl	_	SpaceAfter=No
8	ใหม่	ใหม่	ADV	ADVN	_	7	advmod	_	SpaceAfter=No
>>> import deplacy
>>> deplacy.render(doc,WordRight=True)
 nsubj ╔════════>╔═ NOUN แผนก
   det          > DET  นี้
   aux  ╔════════> AUX  กำลัง
  ROOT ╚═╚═╔═══════ VERB เผชิญ
  case      ╔════> ADP  กับ
   obl     >╚═╔═══ PART ความ
   acl         >╔═ VERB ท้าทาย
advmod           > ADV  ใหม่

Installation for Linux

pip3 install spacy_thai --user

Installation for Cygwin

Make sure to get python37-devel python37-pip python37-numpy python37-cython gcc-g++, and then:

pip3.7 install spacy_thai --no-build-isolation

Installation for Google Colaboratory

!pip install spacy_thai

Try notebook.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

spacy_thai-0.5.2-py3-none-any.whl (5.1 MB view details)

Uploaded Python 3

File details

Details for the file spacy_thai-0.5.2-py3-none-any.whl.

File metadata

  • Download URL: spacy_thai-0.5.2-py3-none-any.whl
  • Upload date:
  • Size: 5.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.0.0 requests-toolbelt/0.8.0 tqdm/4.44.0 CPython/3.7.6

File hashes

Hashes for spacy_thai-0.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0a08438c20c90000466b622c1383cb5b6c55be7f1206a9a12f6901618bb2930e
MD5 17018a2c67f83972e45a3b511c4493da
BLAKE2b-256 ed2a508f3adf2e8cdded0baa4a2f1dda7dab7095df2709334bdfa7cf8ddb862e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page