mack-facets 0.8.1 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/gems.rb +25 -0
- data/lib/gems/english-0.3.1/VERSION +1 -0
- data/lib/gems/english-0.3.1/lib/english/array.rb +48 -0
- data/lib/gems/english-0.3.1/lib/english/censor.rb +76 -0
- data/lib/gems/english-0.3.1/lib/english/double_metaphone.rb +353 -0
- data/lib/gems/english-0.3.1/lib/english/dresner.rb +47 -0
- data/lib/gems/english-0.3.1/lib/english/inflect.rb +299 -0
- data/lib/gems/english-0.3.1/lib/english/jumble.rb +37 -0
- data/lib/gems/english-0.3.1/lib/english/levenshtein.rb +78 -0
- data/lib/gems/english-0.3.1/lib/english/metaphone.rb +110 -0
- data/lib/gems/english-0.3.1/lib/english/numerals.rb +71 -0
- data/lib/gems/english-0.3.1/lib/english/patterns.rb +49 -0
- data/lib/gems/english-0.3.1/lib/english/porter_stemming.rb +188 -0
- data/lib/gems/english-0.3.1/lib/english/roman.rb +174 -0
- data/lib/gems/english-0.3.1/lib/english/similarity.rb +103 -0
- data/lib/gems/english-0.3.1/lib/english/soundex.rb +70 -0
- data/lib/gems/english-0.3.1/lib/english/string.rb +210 -0
- data/lib/gems/english-0.3.1/lib/english/style.rb +294 -0
- data/lib/gems/english-0.3.1/lib/english/style_orm.rb +143 -0
- data/lib/gems/english-0.3.1/lib/english/textfilter.rb +91 -0
- data/lib/gems/extlib-0.9.8/lib/extlib.rb +56 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/assertions.rb +8 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/blank.rb +59 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/boolean.rb +11 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/class.rb +175 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/datetime.rb +9 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/dictionary.rb +433 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/hash.rb +419 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/hook.rb +366 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/inflection.rb +435 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/lazy_array.rb +106 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/logger.rb +202 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/mash.rb +148 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/module.rb +41 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/nil.rb +5 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/numeric.rb +5 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/object.rb +175 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/object_space.rb +13 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/pathname.rb +5 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/pooling.rb +239 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/rubygems.rb +38 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/simple_set.rb +39 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/string.rb +132 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/struct.rb +8 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/symbol.rb +17 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/tasks/release.rb +15 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/time.rb +19 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/version.rb +3 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/virtual_file.rb +10 -0
- data/lib/gems/facets-2.4.5/VERSION +1 -0
- data/lib/gems/facets-2.4.5/lib/core/facets-live.rb +17 -0
- data/lib/gems/facets-2.4.5/lib/core/facets-load.rb +12 -0
- data/lib/gems/facets-2.4.5/lib/core/facets.rb +11 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/array.rb +6 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/array/combination.rb +59 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/array/conjoin.rb +58 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/array/delete.rb +61 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/array/index.rb +48 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/array/indexable.rb +73 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/array/merge.rb +21 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/array/not_empty.rb +13 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/array/only.rb +21 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/array/pad.rb +41 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/array/permutation.rb +30 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/array/product.rb +57 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/array/recursively.rb +30 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/array/rotate.rb +42 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/array/select.rb +16 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/array/splice.rb +30 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/array/stackable.rb +33 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/array/traverse.rb +22 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/binding.rb +6 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/binding/caller.rb +54 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/binding/defined.rb +13 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/binding/eval.rb +18 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/binding/local_variables.rb +15 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/binding/self.rb +12 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/bitmask.rb +104 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/blank.rb +60 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/boolean.rb +156 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/callstack.rb +52 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/cattr.rb +2 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/class.rb +6 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/class/cattr.rb +115 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/class/cattr_accessor.rb +1 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/class/cattr_reader.rb +1 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/class/cattr_writer.rb +1 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/class/descendents.rb +36 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/class/methodize.rb +14 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/class/pathize.rb +14 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/class/prepend.rb +50 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/class/subclasses.rb +2 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/class/to_proc.rb +42 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/comparable.rb +6 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/comparable/bound.rb +65 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/comparable/cmp.rb +38 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/comparable/comparable.rb +42 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/dir.rb +6 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/dir/ascend.rb +59 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/dir/descend.rb +1 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/dir/multiglob.rb +92 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/dir/parent.rb +13 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/dir/recurse.rb +29 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/enumerable.rb +6 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/enumerable/accumulate.rb +21 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/enumerable/cluster_by.rb +21 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/enumerable/collect.rb +54 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/enumerable/commonality.rb +33 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/enumerable/count.rb +26 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/enumerable/divide.rb +33 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/enumerable/duplicates.rb +38 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/enumerable/each_by.rb +33 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/enumerable/entropy.rb +37 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/enumerable/frequency.rb +18 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/enumerable/group_by.rb +27 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/enumerable/inject.rb +31 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/enumerable/map_send.rb +12 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/enumerable/mash.rb +32 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/enumerable/mode.rb +16 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/enumerable/modulate.rb +22 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/enumerable/none.rb +31 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/enumerable/occur.rb +38 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/enumerable/one.rb +38 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/enumerable/probability.rb +36 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/enumerable/split.rb +27 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/enumerable/sum.rb +16 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/enumerable/uniq_by.rb +18 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/exception.rb +6 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/exception/detail.rb +19 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/exception/suppress.rb +21 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/file.rb +6 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/file/append.rb +14 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/file/create.rb +21 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/file/null.rb +21 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/file/read.rb +41 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/file/rewrite.rb +88 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/file/rootname.rb +33 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/file/split_root.rb +10 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/file/write.rb +22 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/file/writelines.rb +24 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/filetest.rb +6 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/filetest/root.rb +17 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/float.rb +6 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/float/round.rb +2 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/functor.rb +77 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash.rb +6 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/alias.rb +31 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/argumentize.rb +22 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/at.rb +8 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/autonew.rb +42 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/collate.rb +45 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/delete.rb +47 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/diff.rb +11 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/except.rb +27 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/insert.rb +19 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/inverse.rb +27 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/join.rb +14 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/keys.rb +45 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/mash.rb +18 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/merge.rb +30 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/op.rb +7 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/op_add.rb +12 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/op_and.rb +33 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/op_mul.rb +18 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/op_or.rb +12 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/op_push.rb +17 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/op_sub.rb +26 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/recursive_merge.rb +33 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/recursively.rb +29 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/rekey.rb +59 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/select.rb +14 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/slice.rb +33 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/swap.rb +17 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/to_h.rb +1 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/to_proc.rb +41 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/to_struct.rb +17 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/traverse.rb +41 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/update.rb +81 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/weave.rb +81 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/zipnew.rb +2 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/indexable.rb +251 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/integer.rb +6 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/integer/even.rb +1 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/integer/factorial.rb +30 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/integer/multiple.rb +15 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/integer/odd.rb +35 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/integer/of.rb +18 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/integer/ordinal.rb +24 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel.rb +6 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/__callee__.rb +1 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/__class__.rb +9 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/__dir__.rb +12 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/__get__.rb +10 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/__method__.rb +36 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/__set__.rb +1 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/as.rb +100 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/ask.rb +27 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/attr_singleton.rb +62 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/complete.rb +18 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/constant.rb +24 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/d.rb +26 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/deep_copy.rb +13 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/demo.rb +23 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/ergo.rb +42 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/here.rb +12 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/in.rb +13 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/instance.rb +19 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/instance_assign.rb +41 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/instance_class.rb +24 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/instance_exec.rb +40 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/instance_send.rb +7 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/instance_variables.rb +99 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/maybe.rb +18 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/not_nil.rb +17 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/object_class.rb +10 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/object_hexid.rb +12 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/object_send.rb +32 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/p.rb +24 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/populate.rb +73 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/qua_class.rb +19 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/require_all.rb +21 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/require_local.rb +24 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/resc.rb +16 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/respond.rb +23 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/returning.rb +23 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/silence.rb +75 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/singleton_class.rb +19 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/tap.rb +32 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/try.rb +23 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/val.rb +19 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/with.rb +20 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/lazy.rb +238 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/matchdata.rb +6 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/matchdata/match.rb +15 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/matchdata/matchset.rb +44 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/metaid.rb +94 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module.rb +6 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/abstract.rb +21 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/alias_accessor.rb +45 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/alias_method_chain.rb +50 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/alias_module_function.rb +30 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/ancestor.rb +16 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/basename.rb +31 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/can.rb +14 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/class.rb +12 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/conflict.rb +63 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/include_function_module.rb +25 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/instance_methods.rb +40 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/integrate.rb +2 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/is.rb +57 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/methodize.rb +14 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/modspace.rb +22 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/module_load.rb +56 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/nesting.rb +18 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/op.rb +95 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/pathize.rb +22 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/prepend.rb +26 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/redefine_method.rb +35 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/redirect_method.rb +45 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/rename_method.rb +20 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/revise.rb +62 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/spacename.rb +25 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/wrap_method.rb +28 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/nilclass.rb +6 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/nilclass/ergo.rb +1 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/nilclass/to_f.rb +17 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/numeric.rb +6 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/numeric/approx.rb +15 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/numeric/distance.rb +14 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/numeric/round.rb +72 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/proc.rb +6 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/proc/bind.rb +22 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/proc/compose.rb +42 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/proc/curry.rb +31 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/proc/to_method.rb +33 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/proc/update.rb +9 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/range.rb +6 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/range/combine.rb +47 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/range/overlap.rb +13 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/range/to_r.rb +26 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/range/umbrella.rb +1 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/range/within.rb +66 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/regexp.rb +6 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/regexp/arity.rb +17 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/regexp/to_re.rb +28 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/stackable.rb +86 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string.rb +6 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/align.rb +106 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/bracket.rb +105 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/bytes.rb +15 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/camelcase.rb +26 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/capitalized.rb +46 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/chars.rb +16 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/chomp.rb +33 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/cleave.rb +36 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/divide.rb +21 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/each_char.rb +29 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/each_word.rb +13 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/end_with.rb +1 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/fold.rb +39 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/interpolate.rb +20 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/line_wrap.rb +21 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/lines.rb +16 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/methodize.rb +17 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/modulize.rb +21 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/mscan.rb +19 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/natcmp.rb +88 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/nchar.rb +28 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/op_sub.rb +14 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/pathize.rb +16 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/range.rb +77 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/rewrite.rb +28 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/shatter.rb +22 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/snakecase.rb +21 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/splice.rb +37 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/start_with.rb +32 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/subtract.rb +4 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/tab.rb +103 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/titlecase.rb +15 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/to_re.rb +26 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/variablize.rb +13 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/word_wrap.rb +34 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/words.rb +12 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/xor.rb +22 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/symbol.rb +6 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/symbol/chomp.rb +24 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/symbol/generate.rb +24 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/symbol/not.rb +29 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/symbol/plain.rb +17 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/symbol/query.rb +1 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/symbol/re_s.rb +18 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/symbol/setter.rb +1 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/symbol/succ.rb +19 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/symbol/to_proc.rb +38 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/symbol/variablize.rb +12 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/time.rb +6 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/time/advance.rb +17 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/time/ago.rb +1 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/time/change.rb +41 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/time/elapse.rb +16 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/time/hence.rb +94 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/time/round.rb +17 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/time/set.rb +21 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/time/stamp.rb +44 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/time/to_time.rb +21 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/time/trunc.rb +15 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/to_hash.rb +87 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/unboundmethod.rb +6 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/unboundmethod/arguments.rb +44 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/unboundmethod/name.rb +25 -0
- data/lib/gems/facets-2.4.5/lib/lore/facets/basicobject.rb +14 -0
- data/lib/gems/facets-2.4.5/lib/lore/facets/cgi.rb +50 -0
- data/lib/gems/facets-2.4.5/lib/lore/facets/continuation.rb +57 -0
- data/lib/gems/facets-2.4.5/lib/lore/facets/date.rb +396 -0
- data/lib/gems/facets-2.4.5/lib/lore/facets/fileutils.rb +27 -0
- data/lib/gems/facets-2.4.5/lib/lore/facets/fileutils/head.rb +1 -0
- data/lib/gems/facets-2.4.5/lib/lore/facets/fileutils/safe_ln.rb +28 -0
- data/lib/gems/facets-2.4.5/lib/lore/facets/fileutils/slice.rb +141 -0
- data/lib/gems/facets-2.4.5/lib/lore/facets/fileutils/tail.rb +1 -0
- data/lib/gems/facets-2.4.5/lib/lore/facets/fileutils/wc.rb +114 -0
- data/lib/gems/facets-2.4.5/lib/lore/facets/fileutils/whereis.rb +64 -0
- data/lib/gems/facets-2.4.5/lib/lore/facets/fileutils/which.rb +101 -0
- data/lib/gems/facets-2.4.5/lib/lore/facets/getoptlong.rb +71 -0
- data/lib/gems/facets-2.4.5/lib/lore/facets/logger.rb +291 -0
- data/lib/gems/facets-2.4.5/lib/lore/facets/ostruct.rb +238 -0
- data/lib/gems/facets-2.4.5/lib/lore/facets/pathname.rb +172 -0
- data/lib/gems/facets-2.4.5/lib/lore/facets/rbconfig.rb +45 -0
- data/lib/gems/facets-2.4.5/lib/lore/facets/set.rb +27 -0
- data/lib/gems/facets-2.4.5/lib/lore/facets/shellwords.rb +89 -0
- data/lib/gems/facets-2.4.5/lib/lore/facets/uri.rb +249 -0
- data/lib/gems/facets-2.4.5/lib/lore/facets/yaml.rb +75 -0
- data/lib/gems/facets-2.4.5/lib/lore/facets/zlib.rb +38 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/1stclassmethod.rb +140 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/advisable.rb +162 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/annotations.rb +302 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/ansicode.rb +315 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/arguments.rb +365 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/argvector.rb +353 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/association.rb +194 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/attr.rb +208 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/autoarray.rb +62 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/autoreload.rb +150 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/basex.rb +37 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/bbcode.rb +397 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/bicrypt.rb +265 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/binding/opvars.rb +24 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/binreadable.rb +221 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/blankslate.rb +66 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/buildable.rb +344 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/bytes.rb +175 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/cachedecorator.rb +117 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/capsule.rb +258 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/chain.rb +58 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/class_extension.rb +114 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/classmethods.rb +199 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/cloneable.rb +76 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/command.rb +439 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/consoleutils.rb +113 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/coroutine.rb +159 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/crypt.rb +166 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/cssfilter.rb +254 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/daemonize.rb +44 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/dependency.rb +151 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/dictionary.rb +478 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/dictionarymatcher.rb +136 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/downloader.rb +281 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/duplicable.rb +43 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/duration.rb +540 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/elementor.rb +133 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/elementwise.rb +61 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/enumerablepass.rb +217 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/equatable.rb +120 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/eventhook.rb +132 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/expirable.rb +82 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/fileable.rb +162 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/filelist.rb +497 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/fileshell.rb +202 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/hash/stringify_keys.rb +1 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/hash/symbolize_keys.rb +94 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/heap.rb +22 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/htmlfilter.rb +595 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/infinity.rb +193 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/inheritor.rb +130 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/ini.rb +264 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/instantiable.rb +47 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/instantise.rb +1 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/instantize.rb +95 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/interval.rb +282 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/ioredirect.rb +130 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/iteration.rb +65 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/kernel/meta.rb +32 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/linkedlist.rb +222 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/lrucache.rb +157 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/main.rb +70 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/memoize.rb +116 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/methodspace.rb +141 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/minitar.rb +1063 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/multipliers.rb +109 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/multiton.rb +386 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/nackclass.rb +41 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/net/smtp_tls.rb +131 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/nilstatus.rb +47 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/nullclass.rb +74 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/opencascade.rb +94 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/opencollection.rb +43 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/openhash.rb +39 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/openobject.rb +267 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/opesc.rb +60 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/orderedhash.rb +37 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/overload.rb +94 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/paramix.rb +202 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/partial.rb +37 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/pathlist.rb +112 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/platform.rb +192 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/pool.rb +91 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/pqueue.rb +449 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/progressbar.rb +253 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/prototype.rb +88 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/random.rb +451 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/rbsystem.rb +222 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/recorder.rb +109 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/reference.rb +99 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/reflection.rb +145 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/registerable.rb +35 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/rwdelegator.rb +74 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/semaphore.rb +92 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/settings.rb +248 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/snapshot.rb +209 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/string/mask.rb +278 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/string/words.rb +173 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/succ.rb +44 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/syncarray.rb +114 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/synchash.rb +157 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/tagiter.rb +366 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/thread.rb +51 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/timer.rb +274 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/times.rb +431 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/tracepoint.rb +209 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/tuple.rb +325 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/typecast.rb +261 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/uninheritable.rb +50 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/uploadutils.rb +464 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/version.rb +136 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/xmlhash.rb +112 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/xoxo.rb +259 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/ziputils.rb +349 -0
- data/lib/mack-facets.rb +4 -2
- data/lib/mack-facets/english_extensions/inflect.rb +50 -50
- data/lib/mack-facets/extensions/string.rb +10 -1
- data/lib/mack-facets/utils/inflections.rb +50 -47
- data/lib/mack-facets/utils/inflector.rb +19 -19
- metadata +547 -36
@@ -0,0 +1,110 @@
|
|
1
|
+
# = title:
|
2
|
+
# Metaphone
|
3
|
+
#
|
4
|
+
# = synopsis:
|
5
|
+
# An implementation of the Metaphone phonetic coding system in Ruby.
|
6
|
+
#
|
7
|
+
# = author:
|
8
|
+
# Paul Battley (pbattley@gmail.com)
|
9
|
+
|
10
|
+
module English # :nodoc:
|
11
|
+
|
12
|
+
# Metaphone encodes names into a phonetic form such that similar-sounding names
|
13
|
+
# have the same or similar Metaphone encodings.
|
14
|
+
#
|
15
|
+
# The original system was described by Lawrence Philips in Computer Language
|
16
|
+
# Vol. 7 No. 12, December 1990, pp 39-43.
|
17
|
+
#
|
18
|
+
# As there are multiple implementations of Metaphone, each with their own
|
19
|
+
# quirks, I have based this on my interpretation of the algorithm specification.
|
20
|
+
# Even LP's original BASIC implementation appears to contain bugs (specifically
|
21
|
+
# with the handling of CC and MB), when compared to his explanation of the
|
22
|
+
# algorithm.
|
23
|
+
#
|
24
|
+
# I have also compared this implementation with that found in PHP's standard
|
25
|
+
# library, which appears to mimic the behaviour of LP's original BASIC
|
26
|
+
# implementation. For compatibility, these rules can also be used by passing
|
27
|
+
# :alternate=>true to the methods.
|
28
|
+
|
29
|
+
module Metaphone
|
30
|
+
|
31
|
+
extend self
|
32
|
+
|
33
|
+
# Metaphone rules. These are simply applied in order.
|
34
|
+
|
35
|
+
RULES = [
|
36
|
+
# Regexp, replacement
|
37
|
+
[ /([bcdfhjklmnpqrstvwxyz])\1+/,
|
38
|
+
'\1' ], # Remove doubled consonants except g.
|
39
|
+
# [PHP] remove c from regexp.
|
40
|
+
[ /^ae/, 'E' ],
|
41
|
+
[ /^[gkp]n/, 'N' ],
|
42
|
+
[ /^wr/, 'R' ],
|
43
|
+
[ /^x/, 'S' ],
|
44
|
+
[ /^wh/, 'W' ],
|
45
|
+
[ /mb$/, 'M' ], # [PHP] remove $ from regexp.
|
46
|
+
[ /(?!^)sch/, 'SK' ],
|
47
|
+
[ /th/, '0' ],
|
48
|
+
[ /t?ch|sh/, 'X' ],
|
49
|
+
[ /c(?=ia)/, 'X' ],
|
50
|
+
[ /[st](?=i[ao])/, 'X' ],
|
51
|
+
[ /s?c(?=[iey])/, 'S' ],
|
52
|
+
[ /[cq]/, 'K' ],
|
53
|
+
[ /dg(?=[iey])/, 'J' ],
|
54
|
+
[ /d/, 'T' ],
|
55
|
+
[ /g(?=h[^aeiou])/, '' ],
|
56
|
+
[ /gn(ed)?/, 'N' ],
|
57
|
+
[ /([^g]|^)g(?=[iey])/,
|
58
|
+
'\1J' ],
|
59
|
+
[ /g+/, 'K' ],
|
60
|
+
[ /ph/, 'F' ],
|
61
|
+
[ /([aeiou])h(?=\b|[^aeiou])/,
|
62
|
+
'\1' ],
|
63
|
+
[ /[wy](?![aeiou])/, '' ],
|
64
|
+
[ /z/, 'S' ],
|
65
|
+
[ /v/, 'F' ],
|
66
|
+
[ /(?!^)[aeiou]+/, '' ],
|
67
|
+
]
|
68
|
+
|
69
|
+
# The rules for the 'buggy' alternate implementation used by PHP etc.
|
70
|
+
|
71
|
+
LP_RULES = RULES.dup
|
72
|
+
LP_RULES[0] = [ /([bdfhjklmnpqrstvwxyz])\1+/, '\1' ]
|
73
|
+
LP_RULES[6] = [ /mb/, 'M' ]
|
74
|
+
|
75
|
+
# Returns the Metaphone representation of a string. If the string contains
|
76
|
+
# multiple words, each word in turn is converted into its Metaphone
|
77
|
+
# representation. Note that only the letters A-Z are supported, so any
|
78
|
+
# language-specific processing should be done beforehand.
|
79
|
+
#
|
80
|
+
# If +alt+ is set to true, alternate 'buggy' rules are used.
|
81
|
+
|
82
|
+
def metaphone(str, alt=nil)
|
83
|
+
return str.strip.split(/\s+/).map{ |w| metaphone_word(w, alt) }.join(' ')
|
84
|
+
end
|
85
|
+
|
86
|
+
private
|
87
|
+
|
88
|
+
def metaphone_word(w, alt=nil)
|
89
|
+
# Normalise case and remove non-ASCII
|
90
|
+
s = w.downcase.gsub(/[^a-z]/, '')
|
91
|
+
# Apply the Metaphone rules
|
92
|
+
rules = alt ? LP_RULES : RULES
|
93
|
+
rules.each { |rx, rep| s.gsub!(rx, rep) }
|
94
|
+
return s.upcase
|
95
|
+
end
|
96
|
+
|
97
|
+
end
|
98
|
+
|
99
|
+
end
|
100
|
+
|
101
|
+
|
102
|
+
class String #:nodoc:
|
103
|
+
|
104
|
+
# Returns the Metaphone representation of a string.
|
105
|
+
|
106
|
+
def metaphone
|
107
|
+
English::Metaphone.metaphone(self)
|
108
|
+
end
|
109
|
+
|
110
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# TITLE
|
2
|
+
#
|
3
|
+
# English Numerals
|
4
|
+
#
|
5
|
+
# SUMMARY:
|
6
|
+
#
|
7
|
+
# Convert integers into english word form.
|
8
|
+
#
|
9
|
+
# AUTHORS:
|
10
|
+
#
|
11
|
+
# Glenn P. Parker
|
12
|
+
|
13
|
+
module English #:nodoc:
|
14
|
+
|
15
|
+
module Numerals
|
16
|
+
|
17
|
+
Ones = %w[ zero one two three four five six seven eight nine ]
|
18
|
+
Teen = %w[ ten eleven twelve thirteen fourteen fifteen
|
19
|
+
sixteen seventeen eighteen nineteen ]
|
20
|
+
Tens = %w[ zero ten twenty thirty forty fifty
|
21
|
+
sixty seventy eighty ninety ]
|
22
|
+
Mega = %w[ none thousand million billion ]
|
23
|
+
|
24
|
+
# Convert an integer to the english spelling of that number.
|
25
|
+
|
26
|
+
def name(integer)
|
27
|
+
places = integer.to_i.to_s.split(//).collect{|s| s.to_i}.reverse
|
28
|
+
name = []
|
29
|
+
((places.length + 2) / 3).times do |p|
|
30
|
+
strings = Numerals.trio(places[p * 3, 3])
|
31
|
+
name.push(Mega[p]) if strings.length > 0 and p > 0
|
32
|
+
name += strings
|
33
|
+
end
|
34
|
+
name.push(Ones[0]) unless name.length > 0
|
35
|
+
name.reverse.join(" ")
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def self.trio(places)
|
41
|
+
strings = []
|
42
|
+
if places[1] == 1
|
43
|
+
strings.push(Teen[places[0]])
|
44
|
+
elsif places[1] and places[1] > 0
|
45
|
+
strings.push(places[0] == 0 ? Tens[places[1]] :
|
46
|
+
"#{Tens[places[1]]}-#{Ones[places[0]]}")
|
47
|
+
elsif places[0] > 0
|
48
|
+
strings.push(Ones[places[0]])
|
49
|
+
end
|
50
|
+
if places[2] and places[2] > 0
|
51
|
+
strings.push("hundred", Ones[places[2]])
|
52
|
+
end
|
53
|
+
strings
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
end # module English
|
59
|
+
|
60
|
+
#
|
61
|
+
|
62
|
+
class Integer #:nodoc:
|
63
|
+
|
64
|
+
#
|
65
|
+
# 10.english #=> 'ten'
|
66
|
+
|
67
|
+
def english
|
68
|
+
English::Numerals.name(self)
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module English
|
2
|
+
|
3
|
+
# = Patterns Function Module
|
4
|
+
#
|
5
|
+
# Returns a Regexp pattern based on the given
|
6
|
+
# pattern string or symbolic name.
|
7
|
+
#
|
8
|
+
# They are also recognizied in plural form.
|
9
|
+
|
10
|
+
module Patterns
|
11
|
+
|
12
|
+
module_function
|
13
|
+
|
14
|
+
# Character
|
15
|
+
|
16
|
+
def char
|
17
|
+
//
|
18
|
+
end
|
19
|
+
|
20
|
+
alias_method :chars, :char
|
21
|
+
alias_method :character, :char
|
22
|
+
alias_method :characters, :char
|
23
|
+
|
24
|
+
# Word
|
25
|
+
|
26
|
+
def word
|
27
|
+
/\s+|\Z/
|
28
|
+
end
|
29
|
+
|
30
|
+
alias_method :words, :word
|
31
|
+
|
32
|
+
# Line
|
33
|
+
|
34
|
+
def line
|
35
|
+
/\Z/
|
36
|
+
end
|
37
|
+
|
38
|
+
alias_method :lines, :line
|
39
|
+
|
40
|
+
# Sentence FIXME
|
41
|
+
|
42
|
+
def sentence
|
43
|
+
/[.]\ /
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
@@ -0,0 +1,188 @@
|
|
1
|
+
# = title:
|
2
|
+
# Porter Stemming
|
3
|
+
#
|
4
|
+
# = synopsis:
|
5
|
+
# This is the Porter Stemming algorithm, ported to Ruby from the
|
6
|
+
# version coded up in Perl. It's easy to follow against the rules
|
7
|
+
# in the original paper in:
|
8
|
+
#
|
9
|
+
# Porter, 1980, An algorithm for suffix stripping, Program, Vol. 14,
|
10
|
+
# no. 3, pp 130-137,
|
11
|
+
#
|
12
|
+
# Taken from http://www.tartarus.org/~martin/PorterStemmer (Public Domain)
|
13
|
+
#
|
14
|
+
# = author:
|
15
|
+
# ?
|
16
|
+
|
17
|
+
module English # :nodoc:
|
18
|
+
|
19
|
+
# This is the Porter Stemming algorithm, ported to Ruby from the
|
20
|
+
# version coded up in Perl. It's easy to follow against the rules
|
21
|
+
# in the original paper in:
|
22
|
+
#
|
23
|
+
# Porter, 1980, An algorithm for suffix stripping, Program, Vol. 14,
|
24
|
+
# no. 3, pp 130-137,
|
25
|
+
#
|
26
|
+
# Taken from http://www.tartarus.org/~martin/PorterStemmer (Public Domain)
|
27
|
+
|
28
|
+
module PorterStemming
|
29
|
+
|
30
|
+
STEP_2_LIST = {
|
31
|
+
'ational' => 'ate', 'tional' => 'tion', 'enci' => 'ence', 'anci' => 'ance',
|
32
|
+
'izer' => 'ize', 'bli' => 'ble',
|
33
|
+
'alli' => 'al', 'entli' => 'ent', 'eli' => 'e', 'ousli' => 'ous',
|
34
|
+
'ization' => 'ize', 'ation' => 'ate',
|
35
|
+
'ator' => 'ate', 'alism' => 'al', 'iveness' => 'ive', 'fulness' => 'ful',
|
36
|
+
'ousness' => 'ous', 'aliti' => 'al',
|
37
|
+
'iviti' => 'ive', 'biliti' => 'ble', 'logi' => 'log'
|
38
|
+
}
|
39
|
+
|
40
|
+
STEP_3_LIST = {
|
41
|
+
'icate' => 'ic', 'ative' => '', 'alize' => 'al', 'iciti' => 'ic',
|
42
|
+
'ical' => 'ic', 'ful' => '', 'ness' => ''
|
43
|
+
}
|
44
|
+
|
45
|
+
SUFFIX_1_REGEXP = /(
|
46
|
+
ational |
|
47
|
+
tional |
|
48
|
+
enci |
|
49
|
+
anci |
|
50
|
+
izer |
|
51
|
+
bli |
|
52
|
+
alli |
|
53
|
+
entli |
|
54
|
+
eli |
|
55
|
+
ousli |
|
56
|
+
ization |
|
57
|
+
ation |
|
58
|
+
ator |
|
59
|
+
alism |
|
60
|
+
iveness |
|
61
|
+
fulness |
|
62
|
+
ousness |
|
63
|
+
aliti |
|
64
|
+
iviti |
|
65
|
+
biliti |
|
66
|
+
logi)$/x
|
67
|
+
|
68
|
+
SUFFIX_2_REGEXP = /(
|
69
|
+
al |
|
70
|
+
ance |
|
71
|
+
ence |
|
72
|
+
er |
|
73
|
+
ic |
|
74
|
+
able |
|
75
|
+
ible |
|
76
|
+
ant |
|
77
|
+
ement |
|
78
|
+
ment |
|
79
|
+
ent |
|
80
|
+
ou |
|
81
|
+
ism |
|
82
|
+
ate |
|
83
|
+
iti |
|
84
|
+
ous |
|
85
|
+
ive |
|
86
|
+
ize)$/x
|
87
|
+
|
88
|
+
C = "[^aeiou]" # consonant
|
89
|
+
V = "[aeiouy]" # vowel
|
90
|
+
CC = "#{C}(?>[^aeiouy]*)" # consonant sequence
|
91
|
+
VV = "#{V}(?>[aeiou]*)" # vowel sequence
|
92
|
+
|
93
|
+
MGR0 = /^(#{CC})?#{VV}#{CC}/o # [cc]vvcc... is m>0
|
94
|
+
MEQ1 = /^(#{CC})?#{VV}#{CC}(#{VV})?$/o # [cc]vvcc[vv] is m=1
|
95
|
+
MGR1 = /^(#{CC})?#{VV}#{CC}#{VV}#{CC}/o # [cc]vvccvvcc... is m>1
|
96
|
+
VOWEL_IN_STEM = /^(#{CC})?#{V}/o # vowel in stem
|
97
|
+
|
98
|
+
def self.stem(word)
|
99
|
+
|
100
|
+
# make a copy of the given object and convert it to a string.
|
101
|
+
word = word.dup.to_str
|
102
|
+
|
103
|
+
return word if word.length < 3
|
104
|
+
|
105
|
+
# now map initial y to Y so that the patterns never treat it as vowel
|
106
|
+
word[0] = 'Y' if word[0] == ?y
|
107
|
+
|
108
|
+
# Step 1a
|
109
|
+
if word =~ /(ss|i)es$/
|
110
|
+
word = $` + $1
|
111
|
+
elsif word =~ /([^s])s$/
|
112
|
+
word = $` + $1
|
113
|
+
end
|
114
|
+
|
115
|
+
# Step 1b
|
116
|
+
if word =~ /eed$/
|
117
|
+
word.chop! if $` =~ MGR0
|
118
|
+
elsif word =~ /(ed|ing)$/
|
119
|
+
stem = $`
|
120
|
+
if stem =~ VOWEL_IN_STEM
|
121
|
+
word = stem
|
122
|
+
case word
|
123
|
+
when /(at|bl|iz)$/ then word << "e"
|
124
|
+
when /([^aeiouylsz])\1$/ then word.chop!
|
125
|
+
when /^#{CC}#{V}[^aeiouwxy]$/o then word << "e"
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
if word =~ /y$/
|
131
|
+
stem = $`
|
132
|
+
word = stem + "i" if stem =~ VOWEL_IN_STEM
|
133
|
+
end
|
134
|
+
|
135
|
+
# Step 2
|
136
|
+
if word =~ SUFFIX_1_REGEXP
|
137
|
+
stem = $`
|
138
|
+
suffix = $1
|
139
|
+
# print "stem= " + stem + "\n" + "suffix=" + suffix + "\n"
|
140
|
+
if stem =~ MGR0
|
141
|
+
word = stem + STEP_2_LIST[suffix]
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
# Step 3
|
146
|
+
if word =~ /(icate|ative|alize|iciti|ical|ful|ness)$/
|
147
|
+
stem = $`
|
148
|
+
suffix = $1
|
149
|
+
if stem =~ MGR0
|
150
|
+
word = stem + STEP_3_LIST[suffix]
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
# Step 4
|
155
|
+
if word =~ SUFFIX_2_REGEXP
|
156
|
+
stem = $`
|
157
|
+
if stem =~ MGR1
|
158
|
+
word = stem
|
159
|
+
end
|
160
|
+
elsif word =~ /(s|t)(ion)$/
|
161
|
+
stem = $` + $1
|
162
|
+
if stem =~ MGR1
|
163
|
+
word = stem
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
# Step 5
|
168
|
+
if word =~ /e$/
|
169
|
+
stem = $`
|
170
|
+
if (stem =~ MGR1) ||
|
171
|
+
(stem =~ MEQ1 && stem !~ /^#{CC}#{V}[^aeiouwxy]$/o)
|
172
|
+
word = stem
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
if word =~ /ll$/ && word =~ MGR1
|
177
|
+
word.chop!
|
178
|
+
end
|
179
|
+
|
180
|
+
# and turn initial Y back to y
|
181
|
+
word[0] = 'y' if word[0] == ?Y
|
182
|
+
|
183
|
+
word
|
184
|
+
end
|
185
|
+
|
186
|
+
end
|
187
|
+
|
188
|
+
end
|
@@ -0,0 +1,174 @@
|
|
1
|
+
# = TITLE:
|
2
|
+
# Roman Numerals
|
3
|
+
#
|
4
|
+
# = SYNOPSIS:
|
5
|
+
# Generates roman numerals from integers and vice-versa.
|
6
|
+
#
|
7
|
+
# = NOTES:
|
8
|
+
# A response to Ruby Quiz of the Week #22 - Roman Numerals [ruby-talk:132925]
|
9
|
+
#
|
10
|
+
# = AUTHORS:
|
11
|
+
# - Dave Burt <dave at burt.id.au>
|
12
|
+
# - Trans
|
13
|
+
|
14
|
+
module English #:nodoc:
|
15
|
+
|
16
|
+
# Contains methods to convert integers to roman numeral strings and vice-versa.
|
17
|
+
|
18
|
+
module RomanNumerals
|
19
|
+
|
20
|
+
# The largest integer representable as a roman
|
21
|
+
# numerable by this module.
|
22
|
+
|
23
|
+
MAX = 3999
|
24
|
+
|
25
|
+
# Stolen from O'Reilly's Perl Cookbook 6.23. Regular Expression Grabbag.
|
26
|
+
|
27
|
+
REGEXP = /^M*(D?C{0,3}|C[DM])(L?X{0,3}|X[LC])(V?I{0,3}|I[VX])$/i
|
28
|
+
|
29
|
+
#
|
30
|
+
|
31
|
+
SYMBOLS = [ "M", "D", "C", "L", "X", "V", "I" ]
|
32
|
+
NUMBERS = [ 1000, 500, 100, 50, 10, 5, 1 ]
|
33
|
+
|
34
|
+
|
35
|
+
# Maps roman numeral digits to their integer values.
|
36
|
+
# {
|
37
|
+
# 'I' => 1,
|
38
|
+
# 'V' => 5,
|
39
|
+
# 'X' => 10,
|
40
|
+
# 'L' => 50,
|
41
|
+
# 'C' => 100,
|
42
|
+
# 'D' => 500,
|
43
|
+
# 'M' => 1000,
|
44
|
+
# }
|
45
|
+
|
46
|
+
TABLE = Hash[*SYMBOLS.zip(NUMBERS).flatten]
|
47
|
+
|
48
|
+
#
|
49
|
+
|
50
|
+
PAIR_SYMBOLS = [ "CM", "CD", "XC", "XL", "IX", "IV", "I" ]
|
51
|
+
PAIR_NUMBERS = [ 900, 400, 90, 40, 9, 4, 1 ]
|
52
|
+
|
53
|
+
# {
|
54
|
+
# 'CM' => 900,
|
55
|
+
# 'CD' => 400,
|
56
|
+
# 'XC' => 90,
|
57
|
+
# 'XL' => 40,
|
58
|
+
# 'IX' => 9,
|
59
|
+
# 'IV' => 4
|
60
|
+
# }
|
61
|
+
|
62
|
+
PAIR_TABLE = Hash[*PAIR_SYMBOLS.zip(PAIR_NUMBERS).flatten]
|
63
|
+
|
64
|
+
#
|
65
|
+
|
66
|
+
LOOKUP = TABLE.invert.merge(PAIR_TABLE.invert)
|
67
|
+
|
68
|
+
|
69
|
+
class << self
|
70
|
+
|
71
|
+
# Converts +integer+ to a roman numeral.
|
72
|
+
|
73
|
+
def from_integer(integer)
|
74
|
+
return nil if integer < 0 || integer > MAX
|
75
|
+
|
76
|
+
r = integer # remainder
|
77
|
+
y = '' # result
|
78
|
+
|
79
|
+
NUMBERS.each do |n|
|
80
|
+
while r >= n
|
81
|
+
r -= n
|
82
|
+
y += LOOKUP[n]
|
83
|
+
end
|
84
|
+
break if r <= 0
|
85
|
+
end
|
86
|
+
|
87
|
+
return y
|
88
|
+
end
|
89
|
+
|
90
|
+
alias_method :roman, :from_integer
|
91
|
+
|
92
|
+
# Converts +roman_string+, a roman numeral, to an integer
|
93
|
+
|
94
|
+
def to_integer(roman_string)
|
95
|
+
return nil unless roman_string.is_roman_numeral?
|
96
|
+
|
97
|
+
l = nil # last
|
98
|
+
i = 0 # integer result
|
99
|
+
|
100
|
+
c = roman_string.to_s.upcase.split(//).reverse
|
101
|
+
|
102
|
+
c.each do |d|
|
103
|
+
if v = TABLE[d]
|
104
|
+
if l && l > v
|
105
|
+
i -= v
|
106
|
+
else
|
107
|
+
i += v
|
108
|
+
end
|
109
|
+
l = v
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
return i
|
114
|
+
end
|
115
|
+
|
116
|
+
alias_method :arabic, :to_integer
|
117
|
+
|
118
|
+
# Returns true iif +string+ is a roman numeral.
|
119
|
+
|
120
|
+
def is_roman_numeral?(string)
|
121
|
+
REGEXP =~ string
|
122
|
+
end
|
123
|
+
|
124
|
+
end
|
125
|
+
|
126
|
+
end
|
127
|
+
|
128
|
+
end # module English
|
129
|
+
|
130
|
+
|
131
|
+
class Integer
|
132
|
+
|
133
|
+
def roman
|
134
|
+
English::RomanNumerals.roman(self) || ''
|
135
|
+
end
|
136
|
+
|
137
|
+
# Converts this integer to a roman numeral.
|
138
|
+
|
139
|
+
def to_s_roman
|
140
|
+
English::RomanNumerals.from_integer(self) || ''
|
141
|
+
end
|
142
|
+
|
143
|
+
end
|
144
|
+
|
145
|
+
|
146
|
+
class String
|
147
|
+
|
148
|
+
# Considers string a roman numeral numeral,
|
149
|
+
# and converts it to the corresponding integer.
|
150
|
+
|
151
|
+
def to_i_roman
|
152
|
+
English::RomanNumerals.to_integer(self)
|
153
|
+
end
|
154
|
+
|
155
|
+
# Returns true iif the subject is a roman numeral.
|
156
|
+
|
157
|
+
def is_roman_numeral?
|
158
|
+
English::RomanNumerals.is_roman_numeral?(self)
|
159
|
+
end
|
160
|
+
|
161
|
+
end
|
162
|
+
|
163
|
+
|
164
|
+
# # Quiz solution: filter that swaps roman and arabic numbers
|
165
|
+
# if __FILE__ == $0
|
166
|
+
# ARGF.each do |line|
|
167
|
+
# line.chomp!
|
168
|
+
# if line.is_roman_numeral?
|
169
|
+
# puts line.to_i_roman
|
170
|
+
# else
|
171
|
+
# puts line.to_i.to_s_roman
|
172
|
+
# end
|
173
|
+
# end
|
174
|
+
# end
|