Skip to content

Commit 6d07904

Browse files
committed
not inf/conj verbs that act as other word issue #4
1 parent 4983a9f commit 6d07904

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

functions/handlers.js

+19-4
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,28 @@ async function getVERBConjugations(infinitive, src, langRef, time, person){
9696
}
9797

9898
async function getVERBInfinitive(word, langRef){
99-
const fullInf = []
100-
for(let w of word.split(' ')){
99+
const fullInf = [];
100+
const wordSplit = word.split(' ');
101+
var i = 0;
102+
while(i < wordSplit.length){
103+
const w = wordSplit[i];
101104
const infinitiveSn = await langRef.child(`VERBS/INFINITIVES/${w}`).get();
102-
if(infinitiveSn.exists()) fullInf.push(infinitiveSn.val())
103-
else fullInf.push(w)
105+
if(infinitiveSn.exists()) {
106+
const [inf, unless] = infinitiveSn.val().split(':')
107+
if(unless){
108+
const unlessSplit = unless.split(' ')
109+
if(unless === wordSplit.slice(i, i+unlessSplit.length).join(' ')){
110+
fullInf.push(unless);
111+
i+=unlessSplit.length;
112+
continue
113+
}
114+
}
115+
fullInf.push(inf) //not necesssary to use "else" bc of "continue"
116+
} else fullInf.push(w)
117+
i++;
104118
}
105119
return fullInf.join(' ')
120+
106121
}
107122

108123
async function handleNOUN(obj, sentence, langRef, src, defaults){

0 commit comments

Comments
 (0)