Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
17
Task/Inverted-index/11l/inverted-index.11l
Normal file
17
Task/Inverted-index/11l/inverted-index.11l
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
DefaultDict[String, Set[String]] index
|
||||
|
||||
F parse_file(fname, fcontents)
|
||||
L(word) fcontents.split(re:‘\W’)
|
||||
:index[word.lowercase()].add(fname)
|
||||
|
||||
L(fname, fcontents) [(‘inv1.txt’, ‘It is what it is.’),
|
||||
(‘inv2.txt’, ‘What is it?’),
|
||||
(‘inv3.txt’, ‘It is a banana!’)]
|
||||
parse_file(fname, fcontents)
|
||||
|
||||
L(w) [‘cat’, ‘is’, ‘banana’, ‘it’, ‘what’]
|
||||
print("\nEnter a word to search for: (q to quit): "w)
|
||||
I w C index
|
||||
print(‘'#.' found in #..’.format(w, sorted(Array(index[w]))))
|
||||
E
|
||||
print(‘'#.' not found.’.format(w))
|
||||
Loading…
Add table
Add a link
Reference in a new issue