Skip to main content

SEACoreNLP: A Python NLP Toolkit for Southeast Asian Languages

SEACoreNLP is an initiative by NLPHub of AI Singapore that aims to provide a one-stop solution for Natural Language Processing (NLP) in Southeast Asia.

It brings together the available open-source resources (be it datasets, models or libraries) and unifies them with a single framework. We also train models on available data whenever the opportunity arises and provide them through our package on top of the third-party libraries and models.

Demo

Please refer to our demo to see our models in action.

Languages Supported

We currently support the following languages:

  • Indonesian
  • Thai
  • Vietnamese

Core NLP Tasks

The core NLP tasks that we cover are as follows:

  • Word Tokenization
  • Sentence Segmentation
  • Part-of-speech Tagging (POS Tagging)
  • Named Entity Recognition (NER)
  • Constituency Parsing
  • Dependency Parsing

Installation

pip install seacorenlp

If you wish to make use of models from Stanza (one of the third-party libraries that we use), ensure that you also install the relevant models after installing seacorenlp.

import stanza

stanza.download('id') # Download Indonesian models
stanza.download('vi') # Download Vietnamese models

# Stanza does not have models for Thai

As there are some dependency conflicts between the latest version of underthesea (a package for Vietnamese NLP that SEACoreNLP depends on) and the other packages used in SEACoreNLP, we are installing an earlier version (1.2.3) that does not have conflicts. However, this version does not contain the Vietnamese dependency parser, so if you wish to make use of that, please manually upgrade the version of underthesea to the latest version.

You may consider using our natively trained Vietnamese dependency parsers if you do not wish to perform this manual upgrade:

from seacorenlp.parsing import DependencyParser

# Load best Vietnamese dependency parser trained on Universal Dependencies data
parser = DependencyParser.from_pretrained("dp-vi-ud-xlmr-best")
parser.predict("Tôi muốn ăn cơm.")

Usage

We provide a command-line interface for training, evaluation and prediction. We also provide classes (such as Tokenizer, POSTagger, NERTagger etc.) and models that can be used in a manner reminiscent of Huggingface Transformers.

from seacorenlp.tagging import POSTagger

th_text = 'ผมอยากกินข้าว'

# Native Models
native_tagger = POSTagger.from_pretrained('pos-th-ud-xlmr')
native_tagger.predict(th_text)
# Output: [('ผม', 'PRON'), ('อยาก', 'VERB'), ('กิน', 'VERB'), ('ข้าว', 'NOUN')]

# External Models
# Include keyword arguments as necessary (see respective class documentation)
external_tagger = POSTagger.from_library('pythainlp', corpus='orchid')
external_tagger.predict(th_text)
# Output: [('ผม', 'PPRS'), ('อยาก', 'XVMM'), ('กิน', 'VACT'), ('ข้าว', 'NCMN')]

Please refer to our documentation for details.

Metadata

Release files for seacorenlp 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for seacorenlp 0.0.2
File Size Uploaded Provenance Actions
seacorenlp-0.0.2.tar.gz 20.5 kB Without provenance Details for seacorenlp-0.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for seacorenlp 0.0.2
File Interpreter ABI Platform Actions
seacorenlp-0.0.2-py3-none-any.whl Python 3 none any Details for seacorenlp-0.0.2-py3-none-any.whl

Total release size: 80.2 kB

Release files / seacorenlp-0.0.2.tar.gz

Download URL seacorenlp-0.0.2.tar.gz
Size 20.5 kB
Tags Source
SHA-256 checksum
How to use checksums
1164a44b24f31e0f66380aba29720c510cab93d1d72553349dc4d02195793614
BLAKE2b-256 checksum
How to use checksums
816c83a48ee1e7460d0ce424c37357f1cf1223d9495dcf5e54a978ebca09ff79
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.0 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.7.9

Release files / seacorenlp-0.0.2-py3-none-any.whl

Download URL seacorenlp-0.0.2-py3-none-any.whl
Size 59.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2525dfc2fc4c2322e980819965b0a746443335f07be9373eaaca155baeda2a89
BLAKE2b-256 checksum
How to use checksums
0d0824fe5684368ce12b009bcd56035398b357b19e9d568921cf40d6ee646178
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.0 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.7.9

Security for seacorenlp 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page