Skip to content

Conversation

wannaphong
Copy link
Member

@wannaphong wannaphong commented Sep 16, 2022

pythainlp.parse.dependency_parsing is dependency parsing for Thai and this pull request will fix #606.

from pythainlp.parse import dependency_parsing

print(dependency_parsing("ผมเป็นคนดี", engine="esupar"))
# output:
# 1       ผม      _       PRON    _       _       3       nsubj   _       SpaceAfter=No
# 2       เป็น     _       VERB    _       _       3       cop     _       SpaceAfter=No
# 3       คน      _       NOUN    _       _       0       root    _       SpaceAfter=No
# 4       ดี       _       VERB    _       _       3       acl     _       SpaceAfter=No

print(dependency_parsing("ผมเป็นคนดี", engine="spacy_thai"))
# output:
# 1       ผม              PRON    PPRS    _       2       nsubj   _       SpaceAfter=No
# 2       เป็น             VERB    VSTA    _       0       ROOT    _       SpaceAfter=No
# 3       คนดี             NOUN    NCMN    _       2       obj     _       SpaceAfter=No

print(dependency_parsing("ผมเป็นคนดี", engine="transformers_ud"))
# output:
# 1	ผม	_	PRON	_	_	3	nsubj	_	SpaceAfter=No
# 2	เป็น	_	VERB	_	_	3	cop	_	SpaceAfter=No
# 3	คน	_	NOUN	_	_	0	root	_	SpaceAfter=No
# 4	ดี	_	VERB	_	_	3	acl	_	SpaceAfter=No

TODO

Your checklist for this pull request

🚨Please review the guidelines for contributing to this repository.

  • Passed code styles and structures
  • Passed code linting checks and unit test

@wannaphong wannaphong added this to the 3.1 milestone Sep 16, 2022
@coveralls
Copy link

coveralls commented Sep 16, 2022

Coverage Status

Coverage decreased (-0.2%) to 95.416% when pulling e9b5ffb on add-dependency-parser into 638c28d on dev.

@wannaphong wannaphong changed the title [WIP] Add pythainlp.parse.dependency_parsing Add pythainlp.parse.dependency_parsing Sep 17, 2022
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 7 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@wannaphong wannaphong merged commit e2a3404 into dev Sep 17, 2022
@wannaphong wannaphong deleted the add-dependency-parser branch September 19, 2022 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add dependency parsing to PyThaiNLP

2 participants