Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(263)

Side by Side Diff: tools/lua/ngrams_aggregate.lua

Issue 1204283002: Add lua scripts for generating n-grams from SKPs (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix comment Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/lua/ngrams.lua ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 -- Aggregate the output from ngrams.lua.
2
3 -- Get the data from all shards.
4 counts = {}
5 dofile("/tmp/lua-output")
6
7 -- Put the data into a sortable "array".
8 countArray = {}
9 for ngram, count in pairs(counts) do
10 table.insert(countArray, {count, ngram})
11 end
12
13 -- Sort the data.
14 function compare(a, b)
15 return a[1] > b[1]
16 end
17 table.sort(countArray, compare)
18
19 -- Write the result.
20 for i, countPair in ipairs(countArray) do
21 io.write(countPair[1], "\t", countPair[2], "\n")
22 end
OLDNEW
« no previous file with comments | « tools/lua/ngrams.lua ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698