N-grams: Difference between revisions
Content added Content deleted
(→{{header|jq}}: fix) |
|||
Line 85:
def ngrams($n):
ascii_upcase as $text
| bow( range(0;$text|1+ length - $n) as $i | $text[$i:$i+$n]);
# The task
Line 98:
{{output}}
<pre>
<pre>
All 2-grams of 'Live and let live' and their frequencies:
A: 1
Line 107 ⟶ 109:
ND: 1
T : 1
VE: 1▼
L: 2
IV: 2
LI: 2
All 3-grams of 'Live and let live' and their frequencies:
Line 120 ⟶ 122:
E A: 1
ET : 1
IVE: 1▼
LET: 1
ND : 1
T L: 1
VE : 1
LIV: 2
Line 137 ⟶ 139:
IVE : 1
LET : 1
LIVE: 1▼
ND L: 1
T LI: 1
VE A: 1
</pre>
</pre>
|