Pywumanber
Python bindings and utilities created with ctypes for wrapping a C implementation of the Wu Manber search algorithm
Install / Use
/learn @cfarrell1980/PywumanberREADME
Installation
Use zypper in python-pywumanber. Currently, this lives in home:babelworx:python
Using pywumanbver
The following code should do an easy search:
from pywumanber import WuManber wm = WuManber(['list','of','keywords','you','want','to','find'],"text in which you want to search") wm.search_text()
When you initialise a WuManber object you must pass the keywords and the string. This can be done in a number of ways.
To pass the keywords you can use:
- a list
- a comma separated string
- a file with one keyword per line
To pass the text you can use:
- a file (absolute path to file)
- a URL (uses urllib to get the contents)
- a string
Using the pywu script
To make usage of pywumanber a little easier and to provide a demo a script called pywu is included in python-pywumanber. This is installed to /usr/bin by the rpm. Use it like this:
pywu 'gesetz,recht,freiheit' /your/text/file.txt
pywu /your/keyword/file.txt /your/text/file.txt
pywu /your/keyword/file.txt "a string can also be passed directly on the commandline"
pywu 'gesetz,recht,freiheit' http://de.wikipedia.de/wiki/Gesetz
You can also modify the behaviour of the search engine with flags such as -v and -c. The flags are: -v,--verbose Use this to actually return the results found -c,--case-sensitive Use this to make the search case sensitive
Copyright, License, Authors
Copyright (c) 2011 Ciaran Farrell, Juergen Weigert
All Rights Reserved.
This program is free software; you can redistribute it and/ormodify
it under the terms of version 2 of the GNU General Public License as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, see the followig website:
https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
Related Skills
node-connect
339.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
83.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
339.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
83.8kCommit, push, and open a PR
