Skip to main content

This program is SDK of Ner service API to handle one sentence or simple text file in chinese.

Project description

ner

SDK to access API of Ner service

This program is SDK of Ner service API.

It can handle one sentence or simple text file by self-hosted NER service or Stanford NER service (http://nlp.stanford.edu:8080/ner/process).

Installation

pip install pyner

Usage

usage: ner.py [-h] [--nertype NERTYPE] [--classifier CLASSIFIER]
              [--endpoint ENDPOINT] [--sentence SENTENCE] [--path PATH]

Process one sentence and simple textfile by remote self-NER service or
Stanford NER one.

optional arguments:
  -h, --help            show this help message and exit
  --nertype NERTYPE     NER service type,0:self-NER(defualt),1:Stanford-NER
  --classifier CLASSIFIER
                        classifier code of Stanford NER service,including
                        7class, 4class, 3class, distsim
  --endpoint ENDPOINT   Endpoint of self-NER service,ignored when Stanford-NER
                        type
  --sentence SENTENCE   Sentence to process
  --path PATH           Path file to process

For instance:

$ python ner.py --endpoint http://example.com/ner/bert/normal --path test.txt --sentence '康龙化成(03759)拟续聘安永华明为2020年度境内会计师事 务所'
{'ORG': ['康龙化成', '安永华明']}
{'LOC': ['新冠', '新疆'],
 'ORG': ['华资实业',
         '明科',
         '中葡',
         '亚星',
         '厦华',
         '中房股份',
         '中房股份',
         '西域旅游',
         '西域旅游',
         '丰华股份',
         '丰华股份',
         '壳公司']}
$ python ner.py --nertype stanford --sentence 'hello, chongqing, intel, IBM, Tecent. Bill Gates said.' --classifier 7class
{'LOC': ['chongqing'],
 'ORG': ['intel', 'IBM', 'Tecent'],
 'PER': ['Gates']}

Project details


Download files

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

Source Distribution

pyner-0.0.4.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyner-0.0.4-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file pyner-0.0.4.tar.gz.

File metadata

  • Download URL: pyner-0.0.4.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.6.12

File hashes

Hashes for pyner-0.0.4.tar.gz
Algorithm Hash digest
SHA256 c6037b69047092953281744d40452f4cf55099978a0e373c375c2f43dae7de0b
MD5 3db2036c224e7da05bd8f669dce7c19c
BLAKE2b-256 7dec4f464742af9fa69fd26045a95d51745fc5e51dae96af16206ecfe83ce837

See more details on using hashes here.

File details

Details for the file pyner-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: pyner-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.6.12

File hashes

Hashes for pyner-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 b1b60a1145be27270a59fe6c5186d9391f7afab5fa0244af7d2986dd0ec5d2de
MD5 30393ee7f29d5540e3afd8251b4cfc02
BLAKE2b-256 35333c0742c322c85db8ae4eaa3226542d265586929f58edee93d0ab555c138c

See more details on using hashes here.

Supported by

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