Try with this
LOAD SubField(F1,' ') as Word, RecNo() as Line, RowNo() as Position INLINE [
I want to learn English
I want to learn Spanish
I want to learn French
Word as Word1,
Position as Position1,
Word & ' ' & Word1 as Pair,
RowNo() as Sequence
Where Position +1 = Position1;
Drop Table Table;
Count(Pair) as Qty
Group by Pair;
Drop Table Final;
sentence 1 : "I want to learn English"
sentence 2 : "I want to learn Spanish"
sentence 3 : "I want to learn French"
for each var in 'learn English','learn Spanish','learn French','I want','want to','to learn'
if(wildmatch(sentence,'*$(var)*'),'$(var)') as lib,
if(wildmatch(sentence,'*$(var)*'),1) as num
community 15.qvw 153.2 K
one solution might be
mapNonLetterToSpace: Mapping LOAD Chr(RecNo()), ' ' AutoGenerate 65535 Where Upper(Chr(RecNo()))=Lower(Chr(RecNo())); mapReduceMultispace: Mapping LOAD Repeat(' ',100-RecNo()), ' ' AutoGenerate 98; tabTextLines: LOAD RowNo() as LineID, TextLine, Trim(MapSubString('mapReduceMultispace',MapSubString('mapNonLetterToSpace',TextLine))) as TextLineWordSep; LOAD * INLINE [ TextLine I want to learn English I want to learn Spanish I want to learn French ]; tabWordTuples: LOAD *, Upper(WordTuple) as WORDTuple, AutoNumber(WordTuple,'WordTupleID') as WordTupleID, AutoNumber(Upper(WordTuple),'WordTupleID') as WORDTupleID, AutoNumber(Hash128(WordTuple,LineID,WordTupleStart),'WordTuplePosID') as WordTuplePosID; LOAD LineID, WordTupleStart, IterNo() as WordTupleLength, Left(SubStrRight,Index(SubStrRight&' ',' ',IterNo())-1) as WordTuple While IterNo() <= SubStringCount(SubStrRight,' ')+1; LOAD LineID, IterNo() as WordTupleStart, Mid(TextLineWordSep,Index(' '&TextLineWordSep,' ',IterNo())) as SubStrRight Resident tabTextLines While IterNo() <= SubStringCount(TextLineWordSep,' ')+1; tabWords: LOAD LineID, WordTupleStart as WordNo, AutoNumber(Hash128(LineID,WordTupleStart),'WordID') as WordID, WordTuple as Word, WORDTuple as WORD Resident tabWordTuples Where WordTupleLength=1 Order By LineID,WordTupleStart; tabWordLink: LOAD WordTuplePosID, AutoNumber(Hash128(LineID,WordTupleStart+IterNo()-1),'WordID') as WordID Resident tabWordTuples While IterNo() <= WordTupleLength; DROP Field LineID From tabWordTuples;
(adapting a more general approach I previously created)
hope this helps
QlikCommunity_Thread_283581.qvw 181.2 K