We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 84c7be3 commit d571ad5Copy full SHA for d571ad5
concordance.js
@@ -0,0 +1,18 @@
1
+const sentenceMapper = (sentences) => {
2
+ return sentences.reduce((map,sentence,index) => {
3
+ return sentence.split(" ").reduce((map,word) => {
4
+ if(word.trim().length < 1) return map;
5
+ const sentenceList = map[word] || [];
6
+ map[word] = sentenceList.concat(index);
7
+ return map;
8
+ },map);
9
+ },{});
10
+}
11
+
12
+const sentenceTokenizer = (abbreviations,document) => {
13
+ return document.split(" ").map((word) => {
14
+ return abbreviations.indexOf(word) !== -1 ? word.replace(".","@") : word;
15
+ }).join(" ").split(".").map((sentence) => {
16
+ return sentence.replace("@",".");
17
+ });
18
0 commit comments