Skip to main content

No project description provided

Project description

Introduction

This package helps you add punctuation and named entity recognition(ner) to Ming-Shilu, it also shows the position where ner or punctuation is used.

Requirement

1. python>=3.8
2. pip>=20.0.2
3. conda>=3.9.0(optional)

Installation

pip install IISRapi

Usage

Import:

from IISRapi.model import tool, data

To use GPU:

You can check the No. of the GPU you want to use by going to task manager

ner_result=tool.IISRner(dev=your_GPU_num)
pun_result=tool.IISRpunctuation(dev=your_GPU_num)

To use CPU:

Change your_GPU_num to -1

Getting result:

method 1:

print(ner_result(your_str))
print(pun_result(your_str))

method 2:

a=data.struct(your_str)
print(ner_result(a))
print(pun_result(a))

Both will print out result in the format struct(Input_string, Result_string, Ner_position, Punctuation_position)

example

# -*- coding: utf-8 -*-
from IISRapi import tool,data

pun_result=tool.IISRpunctuation(dev=1)
ner_result=tool.IISRner(dev=1)

test_str=data.struct(ori_txt="給宣府等處屯牛時調操軍二千八百人於宣府赤城雲州雕鶚屯田俱言無牛耕種乃以河間保定諸府衛官牛五千餘只給之")

for element in pun_result(test_str):
    print(element)
    print('\n')

for element in ner_result(test_str):
    print(element)
    print('\n')

result:

給宣府等處屯牛時調操軍二千八百人於宣府赤城雲州雕鶚屯田俱言無牛耕種乃以河間保定諸府衛官牛五千餘只給之


給宣府等處屯牛。時調操軍二千八百人於宣府、赤城、雲州、雕鶚屯田,俱言無牛耕種,乃以河間、保定諸府衛官牛五千餘只給之。


None


[('。', 6), ('、', 18), ('、', 20), ('、', 22), (',', 26), (',', 32), ('、', 36), ('。', 50)]


給宣府等處屯牛時調操軍二千八百人於宣府赤城雲州雕鶚屯田俱言無牛耕種乃以河間保定諸府衛官牛五千餘只給之


給<LOC>宣府</LOC>等處屯牛時調操軍二千八百人於<LOC>宣府</LOC><LOC>赤城</LOC><LOC>雲州</LOC><LOC>雕鶚</LOC>屯田俱言無牛耕種乃以<WEI>河間</WEI><WEI>保定諸府衛</WEI>官牛五千餘只給之


[(1, 3, 'LOC', '宣府'), (17, 19, 'LOC', '宣府'), (19, 21, 'LOC', '赤城'), (21, 23, 'LOC', '雲州'), (23, 25, 'LOC', '雕鶚'), (35, 37, 'WEI', '河間'), (37, 42, 'WEI', '保定諸府衛')]


None

Notice

  1. If you want to use GPU to run modules, uninstall torch and visit https://pytorch.org/get-started/locally/
  2. If you use both functions at the same time, either ner_res(pun_res(your_str)) or pun_res(ner_res(your_str)), the result will only show the result of the function which is done later.

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

IISRapi-1.3.1.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

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

IISRapi-1.3.1-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file IISRapi-1.3.1.tar.gz.

File metadata

  • Download URL: IISRapi-1.3.1.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.14

File hashes

Hashes for IISRapi-1.3.1.tar.gz
Algorithm Hash digest
SHA256 540a8d374076cb040a21e72fe8d9430bdd999a926e9a192642975c4886a733eb
MD5 e8b715ac1c83756d35131247c2d650c2
BLAKE2b-256 f459ca43c0071af7686736954105cbc7801b73603298e96eafb83d33f5e28f91

See more details on using hashes here.

File details

Details for the file IISRapi-1.3.1-py3-none-any.whl.

File metadata

  • Download URL: IISRapi-1.3.1-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.14

File hashes

Hashes for IISRapi-1.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ac628b0210cfdb29663154bab55f3eee86299d5da1f3ca15a84cd0e68b7cc587
MD5 dcc928b0c5331e148a1643cf333e1eb8
BLAKE2b-256 ed0a692cab56a9472000a90b2912386b5aaf471b201150ba1e12d4eec0159180

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