🐛 fix bug that word_collector.nas split some words incorrectly
This commit is contained in:
parent
add5e0c2cd
commit
10e579dabc
|
@ -23,6 +23,7 @@ var to_lower=func(c){
|
||||||
return c;
|
return c;
|
||||||
elsif('A'[0]<=c[0] and c[0]<='Z'[0])
|
elsif('A'[0]<=c[0] and c[0]<='Z'[0])
|
||||||
return chr(c[0]-'A'[0]+'a'[0]);
|
return chr(c[0]-'A'[0]+'a'[0]);
|
||||||
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
var file_content="";
|
var file_content="";
|
||||||
|
@ -34,9 +35,10 @@ var s="";
|
||||||
for(var i=0;i<len;i+=1){
|
for(var i=0;i<len;i+=1){
|
||||||
var n=file_content[i];
|
var n=file_content[i];
|
||||||
var c=chr(n);
|
var c=chr(n);
|
||||||
if(('a'[0]<=n and n<='z'[0]) or ('A'[0]<=n and n<='Z'[0]) or c=='\''[0] or c=='-'[0]){
|
if(('a'[0]<=n and n<='z'[0]) or ('A'[0]<=n and n<='Z'[0]) or n=='\''[0] or n=='-'[0]){
|
||||||
s~=to_lower(c);
|
s~=to_lower(c);
|
||||||
}elsif(size(s)){
|
}elsif(size(s)){
|
||||||
|
if(s[0]!="-"[0] and s[0]!="'"[0] and s[-1]!="-"[0] and s[-1]!="'"[0])
|
||||||
token[s]+=1;
|
token[s]+=1;
|
||||||
s="";
|
s="";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue