Commit graph

57 commits

Author SHA1 Message Date
Eevee
eb6cae4bf3 Fix whoosh result sorting.
Now results are sorted by is-this-your-language (times levenshtein
distance, if appropriate), then by rough class of result (Pokémon, then
moves, then abilities, etc.) and finally by name.

This fixes a couple issues:

- If both a foreign name and a local name matched a wildcard lookup,
  you'll see the local name.  Before, you'd see whichever happened to be
  first alphabetically.

- Wildcard results are more likely to have useful stuff at the top,
  rather than being dominated by foreign junk and names of obscure
  locations.

This also updates our usage of the whoosh API, which was old and busted
as of 2.0 or so.
2011-09-09 22:31:38 -07:00
Eevee
514ac79216 Improve multilingual support in lookup.
Language identifiers are stored and retrieved, rather than English
names.

Language weighting biases towards the current language, rather than to
English.

Language is no longer considered nullable to indicate English.

Duplicate names in other languages are no longer omitted from the index.
2011-09-08 20:58:29 -07:00
Petr Viktorin
af8215535e Use the new Whoosh API for spelling. May help #181. 2011-08-30 23:17:20 +03:00
Petr Viktorin
d0c01810be Pokemon species split: Lookup & Markdown 2011-05-06 12:26:16 +03:00
Petr Viktorin
dd89c811b8 Move util.py to compatibility.py 2011-04-17 22:30:37 -07:00
Eevee
721b07084f Random lookup algorithm is now more naive, but less broken. 2011-04-03 01:56:27 -07:00
Eevee
8ad84e4032 Removed ProseColumn and TextColumn. Huzzah. 2011-03-23 22:17:02 -07:00
Petr Viktorin
b962a1b4fe Make lookup index respect the moved names 2011-03-13 15:10:11 -07:00
Zhorken
49b7502099 Overhaul the Pokémon form schema. #286 #179 #379 2010-11-29 20:38:04 -05:00
Eevee
cf72e1db36 Crash fix: lookup with empty prefixes. 2010-09-12 21:08:50 -07:00
Eevee
27364e1fbc Fixes for Whoosh 1.0, and better index recreation. 2010-09-12 20:51:51 -07:00
Eevee
3ea1174a31 Make user and code valid_types not interfere when one is language and the other is table. 2010-08-24 23:49:48 -07:00
Eevee
6c004737ac Return more than just ten results for wildcard lookups. #90 2010-08-24 23:49:48 -07:00
Eevee
2431fd6754 Allow restricting lookup by language, with a @ja: prefix. #90 2010-08-24 23:49:47 -07:00
Eevee
b4539aa346 Significantly improved lookup fuzzy matching. 2010-07-07 22:33:14 -07:00
Eevee
5eb41ddeb6 Fuzzy lookup results were not respecting type limits. 2010-07-07 22:33:13 -07:00
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