Jump to content

N-grams: Difference between revisions

166 bytes added ,  2 months ago
m
→‎{{header|Haskell}}: Disaggregated one function, expanded range of test.
m (→‎{{header|Haskell}}: Disaggregated one function, expanded range of test.)
Line 354:
 
windows :: Int -> [a] -> [[a]]
windows n = getZipList . traverse ZipListtranspose . take n . tails
 
transpose :: [[a]] -> [[a]]
transpose [] = []
transpose xs = getZipList (traverse ZipList xs)
 
 
Line 367 ⟶ 371:
>> putStrLn ""
)
[2,0 3,.. 4]</syntaxhighlight>
{{Out}}
<pre>20-GRAMS:
 
1-GRAMS:
(" ",3)
("A",1)
("D",1)
("E",3)
("I",2)
("L",3)
("N",1)
("T",1)
("V",2)
 
2-GRAMS:
(" A",1)
(" L",2)
9,658

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.