diff --git a/README.md b/README.md index a54b4e5..c72f2a0 100644 --- a/README.md +++ b/README.md @@ -31,24 +31,42 @@ Using AnyStyle in Ruby $ [sudo] gem install anystyle -During the statistical analysis of reference strings, AnyStyle relies -on a large feature dictionary; by default, AnyStyle creates a GDBM -database file in the folder of the `anystyle-data` Gem. GDBM bindings -are part of the Ruby standard library and are supported on all platforms, -but you may have to install GDBM on your platform before installing Ruby. -If you do not want to use the GBDM bindings, you can store your dictionary -using a persistent Ruby hash, in memory (not recommended) or use a Redis. -The best way to change the default dictionary adapter is by adjusting -AnyStyle's default configuration (when using the default parser instances -you must set the default before using the parser!): +Reference Parsing +----------------- + +Document Parsing +---------------- + +Training +-------- + +Dictionary Adapters +------------------- +During the statistical analysis of reference strings, AnyStyle relies +on a large feature dictionary; by default, AnyStyle creates a persistent +Ruby Hash in the folder of the `anystyle-data` Gem. This uses up about +2MB of disk space and keeps the entire dictionary in memory. If you prefer +a smaller memory footprint, you can alternatively use AnyStyle's GDBM +dictionary. GDBM bindings are part of the Ruby standard library and are +supported on all platforms, but you may have to install GDBM on your +platform before installing Ruby. + +If you do not want to use the the persistent Ruyb Hash nor the GBDM +bindings, you can store your dictionary in memory (not recommended) or +use a Redis. The best way to change the default dictionary adapter is by +adjusting AnyStyle's default configuration (when using the default parser +instances you must set the default before using the parser): AnyStyle::Dictionary.defaults[:adapter] = :ruby #-> Use a persistent Ruby hash; #-> slower start-up than GDBM but no extra dependency AnyStyle::Dictionary.defaults[:adapter] = :hash - #-> Use in-memory dictionary; slow start-up but no setup necessary + #-> Use in-memory dictionary; slow start-up but uses no space on disk + + require 'anystyle/dictionary/gdbm' + AnyStyle::Dictionary.defaults[:adapter] = :gdbm To use Redis, install the `redis` and `redis/namespace` (optional) Gems and configure AnyStyle to use the Redis adapter: @@ -60,15 +78,6 @@ and configure AnyStyle to use the Redis adapter: AnyStyle::Dictionary::Redis.defaults[:host] = 'localhost' AnyStyle::Dictionary::Redis.defaults[:port] = 6379 -Reference Parsing ------------------ - -Document Parsing ----------------- - -Training --------- - Contributing ------------ The AnyStyle source code is diff --git a/lib/anystyle.rb b/lib/anystyle.rb index 4b99195..f01018d 100644 --- a/lib/anystyle.rb +++ b/lib/anystyle.rb @@ -7,7 +7,6 @@ require 'anystyle/utils' require 'anystyle/dictionary' require 'anystyle/dictionary/marshal' -require 'anystyle/dictionary/gdbm' require 'anystyle/data' require 'anystyle/feature' diff --git a/lib/anystyle/dictionary.rb b/lib/anystyle/dictionary.rb index bed0170..8d3fa03 100644 --- a/lib/anystyle/dictionary.rb +++ b/lib/anystyle/dictionary.rb @@ -10,7 +10,7 @@ class Dictionary @code.freeze @defaults = { - adapter: :gdbm, + adapter: :ruby, source: nil }