Linux SoftwareProgrammingLibrariesmagpy 0.3.0

magpy 0.3.0


Magpy is a Python wrapper for the mg search engine. magpy module features fast full text sarch, indexing and boolean queries. B
Developer:   Matthias Kramm
      more software by author →
Price:  0.00
License:   GPL (GNU General Public License)
File size:   355K
Language:   
OS:   
Rating:   0 /5 (0 votes)
Your vote:  
enlarge screenshot


Magpy is a Python wrapper for the mg search engine.

magpy module features fast full text sarch, indexing and boolean queries.

Both mg and magpy are released under the GPL (General Public License).

Installation:

To install magpy from source, extract the archive magpy-*.tar.gz, and run the following commands:

./configure
python setup.py build
python setup.py install

Usage:

The following script demonstrates a simple search frontend:

#!/usr/bin/python

import mgindexer
import mgquery
import sys

store = mgquery.MGSearchStore("/tmp/data","alice")

while 1:
query = sys.stdin.readline()
q = store.newQuery(query)
print "Searching for",query,"(words",q.words(),")"
for docnum,ranking in q.execute():
print "Document",docnum,"matches (Ranking",ranking,")"


Before this works, you first have to create search store at (here) the location

"/tmp/data", with the name "alice".

The following script creates such a store from a raw text file, which it splits into individual documents by splitting it into paragraphs.

#!/usr/bin/python

import mgindexer

fi = open("alice13a.txt", "rb")
fo = open("alice13a.splitted.txt", "wb")

for line in fi.readlines():
# split the file on the paragraph boundaries
if line.strip() == "":
fo.write(mgindexer.SEPARATOR)
else:
fo.write(line)
fo.close()
fi.close()

mgindexer.makeindex("alice13a.splitted.txt", "/tmp/data/", "alice")

If you have many individual documents you would like to run a search on, the following script is probably closer to what you need (notice it creates a new collection of the name "files", so you have to substitute "alice" by "files" in the example query script above):

#!/usr/bin/python

import mgindexer
import os

PATH = "files/"

fo = open("searchdata.txt", "wb")

for file in os.listdir(PATH):
if os.path.isfile(PATH + file):
# copy file
fi = open(PATH + file, "rb")
for line in fi.readlines():
fo.write(line)
# write document boundary
fo.write(mgindexer.SEPARATOR)
fo.close()

mgindexer.makeindex("searchdata.txt", "/tmp/data", "files")

What's New in This Release:
  • This release adds support for wildcard search (truncation).
  • Document types that have delimiters different from whitespace are now supported.
    tags tmp data  the following  import mgindexer  bin python  python import  following script  usr bin  mgindexer makeindex  write line  close mgindexer  txt tmp  path file  this release  

    Download magpy 0.3.0


     http://www.athana.org/magpy/magpy-0.3.0.tar.gz


    Authors software

    Caiviar 0.3.5 (by Matthias Kramm)
    Caiviar is an Interactive Voice Response (IVR) System based on CAPI

    Athana 0.2.1 (by Matthias Kramm)
    Athana is a webserver written entirely in Python

    magpy 0.3.0 (by Matthias Kramm)
    Magpy is a Python wrapper for the mg search engine.

    magpy module features fast full text sarch, indexing and boolean queries.

    B


    Similar software

    magpy 0.3.0 (by Matthias Kramm)
    Magpy is a Python wrapper for the mg search engine.

    magpy module features fast full text sarch, indexing and boolean queries.

    B

    Template::Tutorial 2.15 (by Andy Wardley)
    Template::Tutorial are template toolkit tutorials.

    This section includes tutorials on using the Template Toolkit

    MathML::Entities 0.13 (by Jacques Distler)
    MathML::Entities is a Perl module that can convert XHTML+MathML Named Entities to Numeric Character References.

    SYNOPSIS

    use M

    pyClamAV 0.3.3 (by Alexandre Norman)
    pyClamAV program is a python binding to libclamav written in C

    Search::ContextGraph 0.15 (by Maciej Ceglowski)
    Search::ContextGraph is a Perl module for spreading activation search engine.

    SYNOPSIS

    use Search::ContextGraph;

    my $cg

    pyao 0.0.2 (by Andrew Chatham)
    pyao is a wrapper for the 'ao' library.

    pyao is a set of Python bindings for Xiph.org's libao, a cross-platform audio output libra

    Extended attributes for Python 0.1.3 (by Manuel Amador)

    Knoda 0.8.2 (by Knoda Team)
    Knoda is a database-frontend for DBase, Mysql, Postgresql, MS Access, SQLite and ODBC

    pymad 0.5.4 (by Jamie Wilkinson)
    pymad is a Python module that allows Python programs to use the MPEG Audio Decoder library.

    pymad provides a high-level API, simil

    File Selection Language 0.5.1 (by Kristian Ovaska)
    File Selection Language (FSL) is a descriptive language for file selection


    Other software in this category

    zlib 1.2.3 (by Jean-loup Gailly)
    zlib is designed to be a free, general-purpose, legally unencumbered, lossless data-compression library for use on virtually any comp

    libjpeg v6b (by Independent JPEG Group)
    libjpeg is a library for handling the JPEG (JFIF) image format

    OpenSSL 0.9.7c (by The OpenSSL Project Team)
    The OpenSSL Project is a collaborative effort to develop a robust, commercial-grade, full-featured, and Open Source toolkit implement

    libxml2 2.6.27 (by DV)
    Libxml2 is the XML C parser and toolkit developed for the Gnome project (but usable outside of the Gnome platform), libxml2 library i

    GNU C library 2.4 (by Andreas Jaeger)
    GNU C library (glibc) is one of the most important components of GNU Hurd and most modern Linux distributions.

    GNU C library is us

  •     search


    Featured Software

    jEdit 4.3 pre8
    jEdit is an Open Source text editor written in Java

    Opera 9.02
    Surf the Internet in a safer, faster, and easier way with Opera browser

    GNU Aspell 0.60.4
    GNU Aspell is a Free and Open Source spell checker designed to eventually replace Ispell


    Subscribe in Rojo
    Google Reader
    Add to My Yahoo!

    Add to My AOL
    Subscribe with Bloglines
    Subscribe in NewsGator Online
    Add 'nixbit linux software' to Newsburst from CNET News.com
    del.icio.us nixbit linux software


    Top tags