File: gen-index.py

package info (click to toggle)
othman 0.2.7-1
  • links: PTS, VCS
  • area: non-free
  • in suites: wheezy
  • size: 4,448 kB
  • sloc: python: 681; makefile: 60
file content (16 lines) | stat: -rwxr-xr-x 464 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#! /usr/bin/python
# -*- coding: UTF-8 -*-

import sys, os, os.path, time
from othman.core import othmanCore, searchIndexer

q=othmanCore(False)
ix=searchIndexer(True)
wc=0
for n,(o,i) in enumerate(q.getAyatIter(1, 6236)):
  for w in i.split(): ix.addWord(w,n+1); wc+=1
d=os.path.dirname(sys.argv[0])
ix.save()
print "got %d words, %d terms (max term length=%d character, term vectors size=%d bytes)." % (wc, ix.terms_count, ix.maxWordLen, ix.term_vectors_size)