NLP模型的文本方面
wild-nlp的Python项目详细描述
野生NLP
损坏输入文本以测试NLP模型的健壮性。 有关详细信息,请参阅https://nlp-demo.readthedocs.io
安装
pip install wild-nlp
用法
fromwildnlp.aspectsimportReverser,PigLatinfromwildnlp.aspects.utilsimportcomposefromwildnlp.datasetsimportSampleDataset# Create a dataset object and load the datasetdataset=SampleDataset()dataset.load()# Crate a composed corruptor function.# Functions will be applied in the same order they appear.composed=compose(Reverser(),PigLatin())# Apply the function to the datasetmodified=dataset.apply(composed)