Skip to content

Commit

Permalink
bugfix and bump version to v0.0.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
yangyaofei committed Dec 18, 2020
1 parent 89bd6bc commit fc41555
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.
1 change: 0 additions & 1 deletion .gitattributes

This file was deleted.

2 changes: 1 addition & 1 deletion nlpir/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import functools
from .exception import NLPIRException

__version__ = "0.0.4"
__version__ = "0.0.4.1"
PACKAGE_DIR = os.path.abspath(os.path.dirname(__file__))
logger = logging.getLogger("nlpir")

Expand Down
6 changes: 5 additions & 1 deletion nlpir/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,11 @@ def __xml2dict__(xml_txt: str) -> typing.List[typing.Dict]:

def searchable_result(
cluster_result: typing.List[typing.Dict]
) -> typing.Tuple[typing.Dict[str, str], typing.Dict[str, typing.List[str]], typing.Dict[str, typing.Set[str]]]:
) -> typing.Tuple[
typing.Dict[str, typing.List[str]],
typing.Dict[str, typing.List[str]],
typing.Dict[str, typing.Set[str]]
]:
"""
The :func:`cluster` 's result is not easily to search the result.
This function will transform the result to a set of result dict to
Expand Down
21 changes: 20 additions & 1 deletion nlpir/key_scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,32 @@ def scan_detail(self, text: str):
"""
Scan text get detail
::
{
'Rules': ['傻逼'],
'illegal':{
'classes': [
{'freq': 1, 'word': '粗言秽语'},
{'freq': 1, 'word': '污言秽语'},
{'freq': 1, 'word': '新华社禁用'}
],
'hit_count': 3,
'keys': ['傻逼'],
'scan_val': 3.333333333333333
},
'line_id': 0,
'org_file': '',
'score': 3.333333333333333
}
:param text:
:return:
"""
result = __instance__.scan_detail(text, handle=self.handle)
result = json.loads(result)
result.pop("Detail")
print(result)
result.pop("Details")
result.pop("filename")
result.pop("legal")
return result
Expand Down

0 comments on commit fc41555

Please sign in to comment.