Commit graph

41 commits

Author SHA1 Message Date
a_magical_me
febfb239fb Python 2.5 compatibility 2010-05-25 14:41:15 -07:00
a_magical_me
ffc30bff8f Factor out logic for finding the default db/index. #180
Note: `if not x:` has changed to `if x is not None:`, changing the
semantics slightly.  Shouldn't be a big issue.
2010-05-13 21:45:51 -07:00
Eevee
5e52bef91a Make plumbing respect the same env vars as the CLI. #180 2010-05-12 23:23:05 -07:00
Eevee
79df4768bf Split PokedexLookup(recreate=True) into its own method. #216 2010-05-12 22:38:36 -07:00
Eevee
9ca0f486f6 Lookup now respects "ability" as a lookup type. 2010-04-30 00:22:03 -07:00
Eevee
97f96a5695 Let lookup accept hex/octal/binary numbers. 2010-04-28 11:37:12 -07:00
Eevee
b9a32beb35 Refactored valid-type handling in lookup.
- User-specified types are now merged with code-enforced ones, rather
  than being blindly clobbered.

- Prefix lookup now supports type prefixes.
2010-04-19 00:33:18 -07:00
Eevee
55dd46fae7 Support natures in lookup. 2010-04-18 22:43:33 -07:00
Eevee
82e797c6d0 Fixed lookup tests to, um, run. 2010-03-28 22:18:27 -07:00
Eevee
41c2ebdeaf Add locations to lookup. Wow, easy. 2010-03-28 22:18:26 -07:00
Eevee
043f8154ae Remove special lookup logic for forms. 2010-03-28 22:18:26 -07:00
Eevee
10ebe04999 Removed forme_name from lookup; added indexed_name to results. 2010-03-28 22:18:25 -07:00
Eevee
add2111205 Lookup index now contains default form names. 2010-03-28 22:18:25 -07:00
Eevee
d6fd697018 Totally overhauled lookup to use a class.
Now state is held within an object, rather than passed back to the
caller who must then pass it in again.  That was retarded and I don't
know why I ever did it.

Code is much cleaner now.

With apologies to anyone running annotate.
2010-03-21 23:27:47 -07:00
Eevee
f9c17584f3 Make lookup ignore accent marks. 2010-03-21 22:10:43 -07:00
Eevee
3ea814661f Lookup no longer crashes if all type prefixes are bogus. 2010-03-15 00:10:09 -07:00
Eevee
a7496ec617 Fixed comments in pokedex.lookup. 2010-02-02 00:07:26 -08:00
Eevee
0a706d44a3 Added ISO-3166 country codes to languages table and lookup. 2009-11-23 21:50:45 -08:00
Eevee
04a2e3fd3d Prefix lookup is now case-insensitive. 2009-10-11 00:39:52 -07:00
Eevee
c66fe4042c Added a prefix_lookup() function, for suggestions. 2009-09-28 20:59:53 -07:00
Eevee
5deb9b2d16 Fixed use of split() in lookup. Now strips whitespace. #94 2009-09-13 20:09:31 -07:00
Eevee
f5853c0a0b Added random lookup. #57 2009-08-24 22:59:39 -07:00
Eevee
9e3d8b317d Wildcard lookup! #89
Test suite no longer reloads the entire database.  Takes too long.

Factored out some magic numbers in lookup().
2009-08-24 22:04:55 -07:00
Eevee
11989d0db2 Some minor lookup refactoring.
Wrote a little add() function to clean up the duplication of
add_document().

Delete the index directory if it exists and we're being forced to
recreate it.
2009-08-24 21:50:19 -07:00
Eevee
293bcaf724 Added whoosh and sqlite files to .gitignore. 2009-08-23 20:46:21 -07:00
Eevee
909e61cc97 Added support for type: prefix and forme lookup. #15 2009-08-23 16:27:13 -07:00
Eevee
a7c0830e48 Return correctly-cased foreign names from lookup. #15 2009-08-22 20:49:07 -07:00
Eevee
a9a88ec3e4 Finally weight lookup results by language. #15 2009-08-22 19:44:57 -07:00
Eevee
9a20969336 Flesh out lookup by number. #15
Note that, unlike SVN veekun, entering "133" will return ANYTHING with an id of 133.
2009-08-22 18:56:02 -07:00
Eevee
2bc41e2c62 Added support for lookup by other language name. #15
English fuzzy matches are preferred, followed by Roomaji and then
everything else.

The return tuple from lookup() now has a `name` parameter for the actual
name that was matched.
2009-08-22 01:13:34 -07:00
Eevee
4e51867e95 Added lookup support for foreign language names. #15
Changed lookup()'s return value to be a list of named tuples so the
caller can know which language each result is in.
2009-08-21 00:30:01 -07:00
Eevee
0b5eba6620 open_index was returning an index instead of a SpellChecker. #15 2009-08-20 21:07:06 -07:00
Eevee
0a893be01d Allow lookup() callers to pass in their own whoosh indices. 2009-08-20 17:36:31 -07:00
Eevee
0300e01cff Removed whoosh hacks; 0.3 obviates them. #15 2009-08-18 23:50:35 -07:00
Eevee
16072ceb44 Added setup command and made lookup work sanely. #15
The setup command loads the default data into a default location, then
creates a whoosh index in a default location.

get_index is now open_index and can be made to explicitly recreate the
index.  It also actually opens the index if it already existed, even
across processes, now that FileStorage is working.

The lookup command takes no switches for aiming at a different database;
it only uses the default data stores.
2009-08-18 23:50:13 -07:00
Eevee
238487c908 Fixed whoosh index creation to work with 0.2.x. #15 2009-08-16 21:03:49 -07:00
Eevee
20d40364b1 Lookup search lowercases the term again; whoops. #15 2009-07-27 18:45:43 -07:00
Eevee
76d7bbe0e7 Added moves, types, items, and abilities to lookup index. #15 2009-07-26 23:18:11 -07:00
Eevee
cce9c26125 Removed the need for a spelling column in the lookup index. #15
Whoosh's spelling module unfortunately ignores any "words" that don't
look like words, even though the algorithm words fine with arbitrary
input.

I had to clone some code from whoosh.spelling, but avoiding the
isalpha() check solved a bunch of problems.  Now the index happily
compares against anything I feed into it.
2009-07-26 00:37:37 -07:00
Eevee
b13ffac247 Pokédex lookup now uses a whoosh index and spell-checker. #15 2009-07-25 01:28:33 -07:00
Eevee
f23a3401f2 Stubbing out a lookup function. #15 2009-07-21 00:12:25 -07:00