Skip to main content

bert_text_pretty 是一个bert 文本特征化和文本后处理解码的包,用于bert工程推理

# -*- coding:utf-8 -*-
import numpy as np
from bert_text_pretty import cls,ner,relation,tokenization



text_list = ["你是谁123456"]


tokenizer = tokenization.FullTokenizer(vocab_file=r'F:\pretrain\chinese_L-12_H-768_A-12\vocab.txt',do_lower_case=True)

feat = cls.cls_text_feature(tokenizer,text_list,max_seq_len=128,with_padding=None)
print(feat)

feat = ner.ner_text_feature(tokenizer,text_list,max_seq_len=128,with_padding=None)
print(feat)

feat = relation.re_text_feature(tokenizer,text_list,max_seq_len=128,with_padding=None)
print(feat)


labels = ['标签1','标签2']
print(cls.load_labels(labels))

print(ner.load_label_bio(labels))


# logits 为bert 预测结果
# ner.ner_decoding(text_list,logits,labels,logits)


# logits 为bert 预测结果
# cls.cls_decoding(text_list,logits,labels,logits)

Metadata

Release files for bert-text-pretty 0.0.4

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

Built distribution (wheel)

Table of built distributions (wheels) for bert-text-pretty 0.0.4
File Interpreter ABI Platform Actions
bert_text_pretty-0.0.4-py3-none-any.whl Python 3 none any Details for bert_text_pretty-0.0.4-py3-none-any.whl

Release files / bert_text_pretty-0.0.4-py3-none-any.whl

Download URL bert_text_pretty-0.0.4-py3-none-any.whl
Size 11.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ee761fc242b798a746f89a98a6b31a5043b9ab26be52511de1bfb87074d1601a
BLAKE2b-256 checksum
How to use checksums
a0ae40639f8d8e7eb8f73203db40fd014452e82201af51c9c106a4f50f0eeb69
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.6.8

Security for bert-text-pretty 0.0.4

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.

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