bert-deid-0.2.3
توضیحات
Remove identifiers from data using BERT
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | bert-deid-0.2.3 |
| نام | bert-deid |
| نسخه کتابخانه | 0.2.3 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Alistair Johnson |
| ایمیل نویسنده | aewj@mit.edu |
| آدرس صفحه اصلی | https://github.com/alistairewj/bert-deid |
| آدرس اینترنتی | https://pypi.org/project/bert-deid/ |
| مجوز | Apache 2.0 |
# bert-deid
Code to fine-tune BERT on a medical note de-identification task.
## Install
* **(Recommended)** Create an environment called `deid`
* `conda env create -f environment.yml`
<!-- * conda: `conda install bert-deid` -->
* pip install locally
* `pip install bert-deid`
## Download
To download the model, we have provided a helper script in bert-deid:
```sh
# note: MODEL_DIR environment variable used by download
# by default, we download to bert_deid_model in the current directory
export MODEL_DIR="bert_deid_model"
bert_deid download
```
## Usage
The model can be imported and used directly within Python.
```python
from bert_deid.model import Transformer
# load in a trained model
model_path = 'bert_deid_model'
deid_model = Transformer(model_path)
with open('tests/example_note.txt', 'r') as fp:
text = ''.join(fp.readlines())
print(deid_model.apply(text, repl='___'))
# we can also get the original predictions
preds = deid_model.predict(text)
# print out the identified entities
for p, pred in enumerate(preds):
prob = pred[0]
label = pred[1]
start, stop = pred[2:]
# print the prediction labels out
print(f'{text[start:stop]:15s} {label} ({prob:0.3f})')
```
نیازمندی
| مقدار | نام |
|---|---|
| >=3.4.5 | nltk |
| >=1.1.0 | mpmath |
| >=1.19.2 | numpy |
| >=1.1.3 | pandas |
| >=4.2.0 | pytest |
| >=1.6.0 | pytorch |
| >=0.23.2 | scikit-learn |
| >=2.3.2 | spacy |
| >=1.6.2 | sympy |
| >=4.32.1 | tqdm |
| >=2020.10.23 | regex |
| >=3.4.0 | transformers |
| >=0.9.2 | tokenizers |
| >=0.2.0 | stanfordnlp |
| >=1.32.0 | google-cloud-storage |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.6 | Python |
نحوه نصب
نصب پکیج whl bert-deid-0.2.3:
pip install bert-deid-0.2.3.whl
نصب پکیج tar.gz bert-deid-0.2.3:
pip install bert-deid-0.2.3.tar.gz