File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ use the parameter `non_word_boundaries`
29
29
- ** entity_name** : the name of the entity to attach to the message
30
30
- ** case_sensitive** : whether to consider case when matching entities. ` False ` by default.
31
31
- ** non_word_boundaries** : characters which shouldn't be considered word boundaries.
32
+ - ** encoding** : the name of the encoding used to read the lookup text file.
32
33
33
34
## Base Usage
34
35
Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ def get_default_config() -> Dict[Text, Any]:
45
45
"non_word_boundaries" : "" ,
46
46
"path" : None ,
47
47
"entity_name" : None ,
48
+ "encoding" : None ,
48
49
}
49
50
50
51
def __init__ (
@@ -63,7 +64,9 @@ def __init__(
63
64
)
64
65
for non_word_boundary in config ["non_word_boundaries" ]:
65
66
self .keyword_processor .add_non_word_boundary (non_word_boundary )
66
- words = pathlib .Path (self .path ).read_text ().split ("\n " )
67
+ words = (
68
+ pathlib .Path (self .path ).read_text (encoding = config ["encoding" ]).split ("\n " )
69
+ )
67
70
if len (words ) == 0 :
68
71
rasa .shared .utils .io .raise_warning (
69
72
f"No words found in the { pathlib .Path (self .path )} file."
You can’t perform that action at this time.
0 commit comments