Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
24
Task/Inverted-index/J/inverted-index-1.j
Normal file
24
Task/Inverted-index/J/inverted-index-1.j
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
require'files regex strings'
|
||||
|
||||
rxutf8 0 NB. support latin1 searches for this example, instead of utf8
|
||||
files=:words=:buckets=:''
|
||||
wordre=: rxcomp '[\w'']+'
|
||||
parse=: ,@:rxfrom~ wordre&rxmatches
|
||||
|
||||
invert=: verb define
|
||||
files=: files,todo=. ~.y-.files
|
||||
>invert1 each todo
|
||||
)
|
||||
|
||||
invert1=: verb define
|
||||
file=. files i.<y
|
||||
words=: ~.words,contents=. ~.parse tolower fread jpath y
|
||||
ind=. words i. contents
|
||||
buckets=: buckets,(1+words -&# buckets)#a:
|
||||
#buckets=: (file,~each ind{buckets) ind}buckets
|
||||
)
|
||||
|
||||
search=: verb define
|
||||
hits=. buckets{~words i.~.parse tolower y
|
||||
files {~ >([-.-.)each/hits
|
||||
)
|
||||
9
Task/Inverted-index/J/inverted-index-2.j
Normal file
9
Task/Inverted-index/J/inverted-index-2.j
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
invert '~help/primer/cut.htm';'~help/primer/end.htm';'~help/primer/gui.htm'
|
||||
>search 'finally learning'
|
||||
~help/primer/end.htm
|
||||
~help/primer/gui.htm
|
||||
>search 'argument'
|
||||
~help/primer/cut.htm
|
||||
~help/primer/gui.htm
|
||||
>search 'around'
|
||||
~help/primer/gui.htm
|
||||
Loading…
Add table
Add a link
Reference in a new issue