melisa 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/bin/melisa +1 -1
  3. data/ext/extconf.rb +1 -2
  4. data/ext/marisa-0.2.4/mkmf.log +27 -27
  5. data/lib/melisa/bytes_trie.rb +1 -1
  6. data/lib/melisa/trie.rb +9 -1
  7. data/lib/melisa/version.rb +1 -1
  8. data/spec/bytes_trie_spec.rb +3 -3
  9. metadata +2 -26
  10. data/ext/marisa-0.2.4/pkg/bin/marisa-benchmark +0 -0
  11. data/ext/marisa-0.2.4/pkg/bin/marisa-build +0 -0
  12. data/ext/marisa-0.2.4/pkg/bin/marisa-common-prefix-search +0 -0
  13. data/ext/marisa-0.2.4/pkg/bin/marisa-dump +0 -0
  14. data/ext/marisa-0.2.4/pkg/bin/marisa-lookup +0 -0
  15. data/ext/marisa-0.2.4/pkg/bin/marisa-predictive-search +0 -0
  16. data/ext/marisa-0.2.4/pkg/bin/marisa-reverse-lookup +0 -0
  17. data/ext/marisa-0.2.4/pkg/include/marisa.h +0 -14
  18. data/ext/marisa-0.2.4/pkg/include/marisa/agent.h +0 -73
  19. data/ext/marisa-0.2.4/pkg/include/marisa/base.h +0 -193
  20. data/ext/marisa-0.2.4/pkg/include/marisa/exception.h +0 -82
  21. data/ext/marisa-0.2.4/pkg/include/marisa/iostream.h +0 -18
  22. data/ext/marisa-0.2.4/pkg/include/marisa/key.h +0 -85
  23. data/ext/marisa-0.2.4/pkg/include/marisa/keyset.h +0 -80
  24. data/ext/marisa-0.2.4/pkg/include/marisa/query.h +0 -71
  25. data/ext/marisa-0.2.4/pkg/include/marisa/scoped-array.h +0 -48
  26. data/ext/marisa-0.2.4/pkg/include/marisa/scoped-ptr.h +0 -52
  27. data/ext/marisa-0.2.4/pkg/include/marisa/stdio.h +0 -15
  28. data/ext/marisa-0.2.4/pkg/include/marisa/trie.h +0 -64
  29. data/ext/marisa-0.2.4/pkg/lib/libmarisa.0.dylib +0 -0
  30. data/ext/marisa-0.2.4/pkg/lib/libmarisa.a +0 -0
  31. data/ext/marisa-0.2.4/pkg/lib/libmarisa.dylib +0 -0
  32. data/ext/marisa-0.2.4/pkg/lib/libmarisa.la +0 -41
  33. data/ext/marisa-0.2.4/pkg/lib/pkgconfig/marisa.pc +0 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 205e021f379f1009ef2e94bd6c8410defb584807
4
- data.tar.gz: 4c949dfa387e5c8533f887d2d3a992e3d06c32c6
3
+ metadata.gz: 296663b7acc8e5049b755fce207a1df657b5fd82
4
+ data.tar.gz: ca5cfaf23076e952cc58b6ee2bc086f5c3ccb8b0
5
5
  SHA512:
6
- metadata.gz: 23b87b08dec6f10478176a4fdcb79eb1d40b966596970869a460166c262067be58fe2f73ff8cd4ee44bf991955f33d07ad5278d979166d37d634a5a35a335761
7
- data.tar.gz: 29f3cabec9128662c6e1094d2feede6100b7b1a5fee6e0b254bea77af07dc38cfad7bfbd27c233c49d56999cbc7181bc251bdb4e0a3a6fb5195383a678c907d6
6
+ metadata.gz: 2107658429a570ad56ea3226e15c0d39d150c76ca89991ac602f19cc371e4e929e4df166a4c42739074055b480e588da17c29173eadac96dc233cf48f94b5f90
7
+ data.tar.gz: 61a4141ddfdc3fc3d360796c52183dd1dd229d0e5273ff1ef2213b9d0f40ce8a0eb6a1d37ff1d703e687e22f470caf1a614ac01d42b4378a4901a0261f2c4d42
data/bin/melisa CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'open3'
3
3
 
4
- BIN_PATH = File.join(File.dirname(__FILE__), '..', 'ext', 'pkg', 'bin')
4
+ BIN_PATH = File.join(File.dirname(__FILE__), '..', 'ext', 'marisa-0.2.4', 'pkg', 'bin')
5
5
 
6
6
  available_commands = %w(lookup reverse-lookup predictive-search benchmark build common-prefix-search dump)
7
7
 
@@ -17,9 +17,8 @@ if `which make`.strip.empty?
17
17
  exit(1)
18
18
  end
19
19
 
20
- MELISA_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
21
20
  MARISA_ROOT = File.expand_path(File.join(File.dirname(__FILE__), "marisa-0.2.4"))
22
- PREFIX = File.join(MELISA_ROOT, 'ext', 'pkg')
21
+ PREFIX = File.join(MARISA_ROOT, 'pkg')
23
22
 
24
23
  FileUtils.cd(MARISA_ROOT) do
25
24
  sys "./configure --enable-sse3 --prefix='#{PREFIX}'"
@@ -1,4 +1,4 @@
1
- "./configure --enable-sse3 --prefix='/Users/duane/Dropbox/Projects/wordtree/melisa/ext/marisa-0.2.4/pkg' --bindir='/Users/duane/Dropbox/Projects/wordtree/melisa/bin'"
1
+ "./configure --enable-sse3 --prefix='/Users/duane/Dropbox/Projects/wordtree/melisa/ext/pkg'"
2
2
  checking for a BSD-compatible install... /usr/bin/install -c
3
3
  checking whether build environment is sane... yes
4
4
  checking for a thread-safe mkdir -p... ./install-sh -c -d
@@ -121,7 +121,7 @@ marisa 0.2.4 configuration:
121
121
  CXX: g++
122
122
  CXXFLAGS: -g -O2 -DMARISA_USE_SSE3 -msse3
123
123
  LDFLAGS:
124
- PREFIX: /Users/duane/Dropbox/Projects/wordtree/melisa/ext/marisa-0.2.4/pkg
124
+ PREFIX: /Users/duane/Dropbox/Projects/wordtree/melisa/ext/pkg
125
125
 
126
126
  SSE2: yes
127
127
  SSE3: yes
@@ -169,24 +169,24 @@ mv -f .deps/tail.Tpo .deps/tail.Plo
169
169
  libtool: compile: g++ -DPACKAGE_NAME=\"marisa\" -DPACKAGE_TARNAME=\"marisa\" -DPACKAGE_VERSION=\"0.2.4\" "-DPACKAGE_STRING=\"marisa 0.2.4\"" -DPACKAGE_BUGREPORT=\"syata@acm.org\" -DPACKAGE_URL=\"\" -DPACKAGE=\"marisa\" -DVERSION=\"0.2.4\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -I. -Wall -Weffc++ -Wextra -g -O2 -DMARISA_USE_SSE3 -msse3 -MT louds-trie.lo -MD -MP -MF .deps/louds-trie.Tpo -c marisa/grimoire/trie/louds-trie.cc -fno-common -DPIC -o .libs/louds-trie.o
170
170
  libtool: compile: g++ -DPACKAGE_NAME=\"marisa\" -DPACKAGE_TARNAME=\"marisa\" -DPACKAGE_VERSION=\"0.2.4\" "-DPACKAGE_STRING=\"marisa 0.2.4\"" -DPACKAGE_BUGREPORT=\"syata@acm.org\" -DPACKAGE_URL=\"\" -DPACKAGE=\"marisa\" -DVERSION=\"0.2.4\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -I. -Wall -Weffc++ -Wextra -g -O2 -DMARISA_USE_SSE3 -msse3 -MT louds-trie.lo -MD -MP -MF .deps/louds-trie.Tpo -c marisa/grimoire/trie/louds-trie.cc -o louds-trie.o >/dev/null 2>&1
171
171
  mv -f .deps/louds-trie.Tpo .deps/louds-trie.Plo
172
- /bin/sh ../libtool --tag=CXX --mode=link g++ -Wall -Weffc++ -Wextra -g -O2 -DMARISA_USE_SSE3 -msse3 -o libmarisa.la -rpath /Users/duane/Dropbox/Projects/wordtree/melisa/ext/marisa-0.2.4/pkg/lib keyset.lo agent.lo trie.lo mapper.lo reader.lo writer.lo bit-vector.lo tail.lo louds-trie.lo
173
- libtool: link: g++ -dynamiclib -Wl,-undefined -Wl,dynamic_lookup -o .libs/libmarisa.0.dylib .libs/keyset.o .libs/agent.o .libs/trie.o .libs/mapper.o .libs/reader.o .libs/writer.o .libs/bit-vector.o .libs/tail.o .libs/louds-trie.o -O2 -msse3 -install_name /Users/duane/Dropbox/Projects/wordtree/melisa/ext/marisa-0.2.4/pkg/lib/libmarisa.0.dylib -compatibility_version 1 -current_version 1.0 -Wl,-single_module
172
+ /bin/sh ../libtool --tag=CXX --mode=link g++ -Wall -Weffc++ -Wextra -g -O2 -DMARISA_USE_SSE3 -msse3 -o libmarisa.la -rpath /Users/duane/Dropbox/Projects/wordtree/melisa/ext/pkg/lib keyset.lo agent.lo trie.lo mapper.lo reader.lo writer.lo bit-vector.lo tail.lo louds-trie.lo
173
+ libtool: link: g++ -dynamiclib -Wl,-undefined -Wl,dynamic_lookup -o .libs/libmarisa.0.dylib .libs/keyset.o .libs/agent.o .libs/trie.o .libs/mapper.o .libs/reader.o .libs/writer.o .libs/bit-vector.o .libs/tail.o .libs/louds-trie.o -O2 -msse3 -install_name /Users/duane/Dropbox/Projects/wordtree/melisa/ext/pkg/lib/libmarisa.0.dylib -compatibility_version 1 -current_version 1.0 -Wl,-single_module
174
174
  libtool: link: (cd ".libs" && rm -f "libmarisa.dylib" && ln -s "libmarisa.0.dylib" "libmarisa.dylib")
175
175
  libtool: link: ar cru .libs/libmarisa.a keyset.o agent.o trie.o mapper.o reader.o writer.o bit-vector.o tail.o louds-trie.o
176
176
  libtool: link: ranlib .libs/libmarisa.a
177
177
  libtool: link: ( cd ".libs" && rm -f "libmarisa.la" && ln -s "../libmarisa.la" "libmarisa.la" )
178
- test -z "/Users/duane/Dropbox/Projects/wordtree/melisa/ext/marisa-0.2.4/pkg/lib" || .././install-sh -c -d "/Users/duane/Dropbox/Projects/wordtree/melisa/ext/marisa-0.2.4/pkg/lib"
179
- /bin/sh ../libtool --mode=install /usr/bin/install -c libmarisa.la '/Users/duane/Dropbox/Projects/wordtree/melisa/ext/marisa-0.2.4/pkg/lib'
180
- libtool: install: /usr/bin/install -c .libs/libmarisa.0.dylib /Users/duane/Dropbox/Projects/wordtree/melisa/ext/marisa-0.2.4/pkg/lib/libmarisa.0.dylib
181
- libtool: install: (cd /Users/duane/Dropbox/Projects/wordtree/melisa/ext/marisa-0.2.4/pkg/lib && { ln -s -f libmarisa.0.dylib libmarisa.dylib || { rm -f libmarisa.dylib && ln -s libmarisa.0.dylib libmarisa.dylib; }; })
182
- libtool: install: /usr/bin/install -c .libs/libmarisa.lai /Users/duane/Dropbox/Projects/wordtree/melisa/ext/marisa-0.2.4/pkg/lib/libmarisa.la
183
- libtool: install: /usr/bin/install -c .libs/libmarisa.a /Users/duane/Dropbox/Projects/wordtree/melisa/ext/marisa-0.2.4/pkg/lib/libmarisa.a
184
- libtool: install: chmod 644 /Users/duane/Dropbox/Projects/wordtree/melisa/ext/marisa-0.2.4/pkg/lib/libmarisa.a
185
- libtool: install: ranlib /Users/duane/Dropbox/Projects/wordtree/melisa/ext/marisa-0.2.4/pkg/lib/libmarisa.a
186
- test -z "/Users/duane/Dropbox/Projects/wordtree/melisa/ext/marisa-0.2.4/pkg/include" || .././install-sh -c -d "/Users/duane/Dropbox/Projects/wordtree/melisa/ext/marisa-0.2.4/pkg/include"
187
- /usr/bin/install -c -m 644 marisa.h '/Users/duane/Dropbox/Projects/wordtree/melisa/ext/marisa-0.2.4/pkg/include'
188
- test -z "/Users/duane/Dropbox/Projects/wordtree/melisa/ext/marisa-0.2.4/pkg/include/marisa" || .././install-sh -c -d "/Users/duane/Dropbox/Projects/wordtree/melisa/ext/marisa-0.2.4/pkg/include/marisa"
189
- /usr/bin/install -c -m 644 marisa/base.h marisa/exception.h marisa/scoped-ptr.h marisa/scoped-array.h marisa/key.h marisa/keyset.h marisa/query.h marisa/agent.h marisa/stdio.h marisa/iostream.h marisa/trie.h '/Users/duane/Dropbox/Projects/wordtree/melisa/ext/marisa-0.2.4/pkg/include/marisa'
178
+ test -z "/Users/duane/Dropbox/Projects/wordtree/melisa/ext/pkg/lib" || .././install-sh -c -d "/Users/duane/Dropbox/Projects/wordtree/melisa/ext/pkg/lib"
179
+ /bin/sh ../libtool --mode=install /usr/bin/install -c libmarisa.la '/Users/duane/Dropbox/Projects/wordtree/melisa/ext/pkg/lib'
180
+ libtool: install: /usr/bin/install -c .libs/libmarisa.0.dylib /Users/duane/Dropbox/Projects/wordtree/melisa/ext/pkg/lib/libmarisa.0.dylib
181
+ libtool: install: (cd /Users/duane/Dropbox/Projects/wordtree/melisa/ext/pkg/lib && { ln -s -f libmarisa.0.dylib libmarisa.dylib || { rm -f libmarisa.dylib && ln -s libmarisa.0.dylib libmarisa.dylib; }; })
182
+ libtool: install: /usr/bin/install -c .libs/libmarisa.lai /Users/duane/Dropbox/Projects/wordtree/melisa/ext/pkg/lib/libmarisa.la
183
+ libtool: install: /usr/bin/install -c .libs/libmarisa.a /Users/duane/Dropbox/Projects/wordtree/melisa/ext/pkg/lib/libmarisa.a
184
+ libtool: install: chmod 644 /Users/duane/Dropbox/Projects/wordtree/melisa/ext/pkg/lib/libmarisa.a
185
+ libtool: install: ranlib /Users/duane/Dropbox/Projects/wordtree/melisa/ext/pkg/lib/libmarisa.a
186
+ test -z "/Users/duane/Dropbox/Projects/wordtree/melisa/ext/pkg/include" || .././install-sh -c -d "/Users/duane/Dropbox/Projects/wordtree/melisa/ext/pkg/include"
187
+ /usr/bin/install -c -m 644 marisa.h '/Users/duane/Dropbox/Projects/wordtree/melisa/ext/pkg/include'
188
+ test -z "/Users/duane/Dropbox/Projects/wordtree/melisa/ext/pkg/include/marisa" || .././install-sh -c -d "/Users/duane/Dropbox/Projects/wordtree/melisa/ext/pkg/include/marisa"
189
+ /usr/bin/install -c -m 644 marisa/base.h marisa/exception.h marisa/scoped-ptr.h marisa/scoped-array.h marisa/key.h marisa/keyset.h marisa/query.h marisa/agent.h marisa/stdio.h marisa/iostream.h marisa/trie.h '/Users/duane/Dropbox/Projects/wordtree/melisa/ext/pkg/include/marisa'
190
190
  Making install in tools
191
191
  /bin/sh ../libtool --tag=CXX --mode=compile g++ -DPACKAGE_NAME=\"marisa\" -DPACKAGE_TARNAME=\"marisa\" -DPACKAGE_VERSION=\"0.2.4\" -DPACKAGE_STRING=\"marisa\ 0.2.4\" -DPACKAGE_BUGREPORT=\"syata@acm.org\" -DPACKAGE_URL=\"\" -DPACKAGE=\"marisa\" -DVERSION=\"0.2.4\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -I. -Wall -Weffc++ -Wextra -I../lib -g -O2 -DMARISA_USE_SSE3 -msse3 -MT cmdopt.lo -MD -MP -MF .deps/cmdopt.Tpo -c -o cmdopt.lo cmdopt.cc
192
192
  libtool: compile: g++ -DPACKAGE_NAME=\"marisa\" -DPACKAGE_TARNAME=\"marisa\" -DPACKAGE_VERSION=\"0.2.4\" "-DPACKAGE_STRING=\"marisa 0.2.4\"" -DPACKAGE_BUGREPORT=\"syata@acm.org\" -DPACKAGE_URL=\"\" -DPACKAGE=\"marisa\" -DVERSION=\"0.2.4\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -I. -Wall -Weffc++ -Wextra -I../lib -g -O2 -DMARISA_USE_SSE3 -msse3 -MT cmdopt.lo -MD -MP -MF .deps/cmdopt.Tpo -c cmdopt.cc -fno-common -DPIC -o .libs/cmdopt.o
@@ -224,22 +224,22 @@ g++ -DPACKAGE_NAME=\"marisa\" -DPACKAGE_TARNAME=\"marisa\" -DPACKAGE_VERSION=\"0
224
224
  mv -f .deps/marisa-benchmark.Tpo .deps/marisa-benchmark.Po
225
225
  /bin/sh ../libtool --tag=CXX --mode=link g++ -Wall -Weffc++ -Wextra -I../lib -g -O2 -DMARISA_USE_SSE3 -msse3 -o marisa-benchmark marisa-benchmark.o ../lib/libmarisa.la libcmdopt.la
226
226
  libtool: link: g++ -Wall -Weffc++ -Wextra -I../lib -g -O2 -DMARISA_USE_SSE3 -msse3 -o .libs/marisa-benchmark marisa-benchmark.o -Wl,-bind_at_load ../lib/.libs/libmarisa.dylib ./.libs/libcmdopt.a
227
- test -z "/Users/duane/Dropbox/Projects/wordtree/melisa/bin" || .././install-sh -c -d "/Users/duane/Dropbox/Projects/wordtree/melisa/bin"
228
- /bin/sh ../libtool --mode=install /usr/bin/install -c marisa-build marisa-lookup marisa-reverse-lookup marisa-common-prefix-search marisa-predictive-search marisa-dump marisa-benchmark '/Users/duane/Dropbox/Projects/wordtree/melisa/bin'
229
- libtool: install: /usr/bin/install -c .libs/marisa-build /Users/duane/Dropbox/Projects/wordtree/melisa/bin/marisa-build
230
- libtool: install: /usr/bin/install -c .libs/marisa-lookup /Users/duane/Dropbox/Projects/wordtree/melisa/bin/marisa-lookup
231
- libtool: install: /usr/bin/install -c .libs/marisa-reverse-lookup /Users/duane/Dropbox/Projects/wordtree/melisa/bin/marisa-reverse-lookup
232
- libtool: install: /usr/bin/install -c .libs/marisa-common-prefix-search /Users/duane/Dropbox/Projects/wordtree/melisa/bin/marisa-common-prefix-search
233
- libtool: install: /usr/bin/install -c .libs/marisa-predictive-search /Users/duane/Dropbox/Projects/wordtree/melisa/bin/marisa-predictive-search
234
- libtool: install: /usr/bin/install -c .libs/marisa-dump /Users/duane/Dropbox/Projects/wordtree/melisa/bin/marisa-dump
235
- libtool: install: /usr/bin/install -c .libs/marisa-benchmark /Users/duane/Dropbox/Projects/wordtree/melisa/bin/marisa-benchmark
227
+ test -z "/Users/duane/Dropbox/Projects/wordtree/melisa/ext/pkg/bin" || .././install-sh -c -d "/Users/duane/Dropbox/Projects/wordtree/melisa/ext/pkg/bin"
228
+ /bin/sh ../libtool --mode=install /usr/bin/install -c marisa-build marisa-lookup marisa-reverse-lookup marisa-common-prefix-search marisa-predictive-search marisa-dump marisa-benchmark '/Users/duane/Dropbox/Projects/wordtree/melisa/ext/pkg/bin'
229
+ libtool: install: /usr/bin/install -c .libs/marisa-build /Users/duane/Dropbox/Projects/wordtree/melisa/ext/pkg/bin/marisa-build
230
+ libtool: install: /usr/bin/install -c .libs/marisa-lookup /Users/duane/Dropbox/Projects/wordtree/melisa/ext/pkg/bin/marisa-lookup
231
+ libtool: install: /usr/bin/install -c .libs/marisa-reverse-lookup /Users/duane/Dropbox/Projects/wordtree/melisa/ext/pkg/bin/marisa-reverse-lookup
232
+ libtool: install: /usr/bin/install -c .libs/marisa-common-prefix-search /Users/duane/Dropbox/Projects/wordtree/melisa/ext/pkg/bin/marisa-common-prefix-search
233
+ libtool: install: /usr/bin/install -c .libs/marisa-predictive-search /Users/duane/Dropbox/Projects/wordtree/melisa/ext/pkg/bin/marisa-predictive-search
234
+ libtool: install: /usr/bin/install -c .libs/marisa-dump /Users/duane/Dropbox/Projects/wordtree/melisa/ext/pkg/bin/marisa-dump
235
+ libtool: install: /usr/bin/install -c .libs/marisa-benchmark /Users/duane/Dropbox/Projects/wordtree/melisa/ext/pkg/bin/marisa-benchmark
236
236
  make[2]: Nothing to be done for `install-data-am'.
237
237
  Making install in tests
238
238
  make[2]: Nothing to be done for `install-exec-am'.
239
239
  make[2]: Nothing to be done for `install-data-am'.
240
240
  make[2]: Nothing to be done for `install-exec-am'.
241
- test -z "/Users/duane/Dropbox/Projects/wordtree/melisa/ext/marisa-0.2.4/pkg/lib/pkgconfig" || ./install-sh -c -d "/Users/duane/Dropbox/Projects/wordtree/melisa/ext/marisa-0.2.4/pkg/lib/pkgconfig"
242
- /usr/bin/install -c -m 644 marisa.pc '/Users/duane/Dropbox/Projects/wordtree/melisa/ext/marisa-0.2.4/pkg/lib/pkgconfig'
241
+ test -z "/Users/duane/Dropbox/Projects/wordtree/melisa/ext/pkg/lib/pkgconfig" || ./install-sh -c -d "/Users/duane/Dropbox/Projects/wordtree/melisa/ext/pkg/lib/pkgconfig"
242
+ /usr/bin/install -c -m 644 marisa.pc '/Users/duane/Dropbox/Projects/wordtree/melisa/ext/pkg/lib/pkgconfig'
243
243
  "make distclean"
244
244
  Making distclean in tests
245
245
  rm -f base-test io-test vector-test trie-test marisa-test
@@ -8,7 +8,7 @@ module Melisa
8
8
  @sep = separator
9
9
  @sep_c = separator.force_encoding('binary').ord
10
10
 
11
- add_many(hash, [])
11
+ add_many(hash)
12
12
  end
13
13
 
14
14
  def add_many(hash, weight=nil)
@@ -52,6 +52,7 @@ module Melisa
52
52
  alias :<< :add
53
53
 
54
54
  def add_many(keys, weights)
55
+ raise ImmutableError, "Can't add keys, Trie already built" if @built
55
56
  for key, weight in keys.zip(weights)
56
57
  push(key, weight)
57
58
  end
@@ -64,6 +65,13 @@ module Melisa
64
65
  agent.key_id if agent.key_str
65
66
  end
66
67
 
68
+ def get_weight(key)
69
+ build_if_necessary
70
+ agent.set_query(key)
71
+ trie.lookup(agent)
72
+ agent.key.weight if agent.key_str
73
+ end
74
+
67
75
  def get_key(id)
68
76
  build_if_necessary
69
77
  agent.set_query(id)
@@ -118,7 +126,7 @@ module Melisa
118
126
 
119
127
  def push(key, weight=nil)
120
128
  if weight
121
- @keyset.push_back(key) #, weight) # For now, ignore weight due to marisa C++ binding issue
129
+ @keyset.push_back(key, weight)
122
130
  else
123
131
  @keyset.push_back(key)
124
132
  end
@@ -1,3 +1,3 @@
1
1
  module Melisa
2
- VERSION = '0.2.2'
2
+ VERSION = '0.2.3'
3
3
  end
@@ -5,9 +5,9 @@ describe Melisa::BytesTrie do
5
5
  let(:trie) { Melisa::BytesTrie.new(hash) }
6
6
 
7
7
  it "stores values" do
8
- trie['one'].should == '1'
9
- trie['two'].should == '2'
10
- trie['onetwo'].should == '3'
8
+ expect(trie['one']).to eq '1'
9
+ expect(trie['two']).to eq '2'
10
+ expect(trie['onetwo']).to eq '3'
11
11
  end
12
12
 
13
13
  it "sets and gets values" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: melisa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Duane Johnson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-27 00:00:00.000000000 Z
11
+ date: 2014-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -157,30 +157,6 @@ files:
157
157
  - ext/marisa-0.2.4/marisa.pc.in
158
158
  - ext/marisa-0.2.4/missing
159
159
  - ext/marisa-0.2.4/mkmf.log
160
- - ext/marisa-0.2.4/pkg/bin/marisa-benchmark
161
- - ext/marisa-0.2.4/pkg/bin/marisa-build
162
- - ext/marisa-0.2.4/pkg/bin/marisa-common-prefix-search
163
- - ext/marisa-0.2.4/pkg/bin/marisa-dump
164
- - ext/marisa-0.2.4/pkg/bin/marisa-lookup
165
- - ext/marisa-0.2.4/pkg/bin/marisa-predictive-search
166
- - ext/marisa-0.2.4/pkg/bin/marisa-reverse-lookup
167
- - ext/marisa-0.2.4/pkg/include/marisa.h
168
- - ext/marisa-0.2.4/pkg/include/marisa/agent.h
169
- - ext/marisa-0.2.4/pkg/include/marisa/base.h
170
- - ext/marisa-0.2.4/pkg/include/marisa/exception.h
171
- - ext/marisa-0.2.4/pkg/include/marisa/iostream.h
172
- - ext/marisa-0.2.4/pkg/include/marisa/key.h
173
- - ext/marisa-0.2.4/pkg/include/marisa/keyset.h
174
- - ext/marisa-0.2.4/pkg/include/marisa/query.h
175
- - ext/marisa-0.2.4/pkg/include/marisa/scoped-array.h
176
- - ext/marisa-0.2.4/pkg/include/marisa/scoped-ptr.h
177
- - ext/marisa-0.2.4/pkg/include/marisa/stdio.h
178
- - ext/marisa-0.2.4/pkg/include/marisa/trie.h
179
- - ext/marisa-0.2.4/pkg/lib/libmarisa.0.dylib
180
- - ext/marisa-0.2.4/pkg/lib/libmarisa.a
181
- - ext/marisa-0.2.4/pkg/lib/libmarisa.dylib
182
- - ext/marisa-0.2.4/pkg/lib/libmarisa.la
183
- - ext/marisa-0.2.4/pkg/lib/pkgconfig/marisa.pc
184
160
  - ext/marisa-0.2.4/tests/Makefile.am
185
161
  - ext/marisa-0.2.4/tests/Makefile.in
186
162
  - ext/marisa-0.2.4/tests/base-test.cc
@@ -1,14 +0,0 @@
1
- #ifndef MARISA_H_
2
- #define MARISA_H_
3
-
4
- // "marisa/stdio.h" includes <cstdio> for I/O using std::FILE.
5
- #include "marisa/stdio.h"
6
-
7
- // "marisa/iostream.h" includes <iosfwd> for I/O using std::iostream.
8
- #include "marisa/iostream.h"
9
-
10
- // You can use <marisa/trie.h> instead of <marisa.h> if you don't need the
11
- // above I/O interfaces and don't want to include the above I/O headers.
12
- #include "marisa/trie.h"
13
-
14
- #endif // MARISA_H_
@@ -1,73 +0,0 @@
1
- #ifndef MARISA_AGENT_H_
2
- #define MARISA_AGENT_H_
3
-
4
- #include "key.h"
5
- #include "query.h"
6
-
7
- namespace marisa {
8
- namespace grimoire {
9
- namespace trie {
10
-
11
- class State;
12
-
13
- } // namespace trie
14
- } // namespace grimoire
15
-
16
- class Agent {
17
- public:
18
- Agent();
19
- ~Agent();
20
-
21
- const Query &query() const {
22
- return query_;
23
- }
24
- const Key &key() const {
25
- return key_;
26
- }
27
-
28
- void set_query(const char *str);
29
- void set_query(const char *ptr, std::size_t length);
30
- void set_query(std::size_t key_id);
31
-
32
- const grimoire::trie::State &state() const {
33
- return *state_;
34
- }
35
- grimoire::trie::State &state() {
36
- return *state_;
37
- }
38
-
39
- void set_key(const char *str) {
40
- MARISA_DEBUG_IF(str == NULL, MARISA_NULL_ERROR);
41
- key_.set_str(str);
42
- }
43
- void set_key(const char *ptr, std::size_t length) {
44
- MARISA_DEBUG_IF((ptr == NULL) && (length != 0), MARISA_NULL_ERROR);
45
- MARISA_DEBUG_IF(length > MARISA_UINT32_MAX, MARISA_SIZE_ERROR);
46
- key_.set_str(ptr, length);
47
- }
48
- void set_key(std::size_t id) {
49
- MARISA_DEBUG_IF(id > MARISA_UINT32_MAX, MARISA_SIZE_ERROR);
50
- key_.set_id(id);
51
- }
52
-
53
- bool has_state() const {
54
- return state_.get() != NULL;
55
- }
56
- void init_state();
57
-
58
- void clear();
59
- void swap(Agent &rhs);
60
-
61
- private:
62
- Query query_;
63
- Key key_;
64
- scoped_ptr<grimoire::trie::State> state_;
65
-
66
- // Disallows copy and assignment.
67
- Agent(const Agent &);
68
- Agent &operator=(const Agent &);
69
- };
70
-
71
- } // namespace marisa
72
-
73
- #endif // MARISA_AGENT_H_
@@ -1,193 +0,0 @@
1
- #ifndef MARISA_BASE_H_
2
- #define MARISA_BASE_H_
3
-
4
- // Old Visual C++ does not provide stdint.h.
5
- #ifndef _MSC_VER
6
- #include <stdint.h>
7
- #endif // _MSC_VER
8
-
9
- #ifdef __cplusplus
10
- #include <cstddef>
11
- #else // __cplusplus
12
- #include <stddef.h>
13
- #endif // __cplusplus
14
-
15
- #ifdef __cplusplus
16
- extern "C" {
17
- #endif // __cplusplus
18
-
19
- #ifdef _MSC_VER
20
- typedef unsigned __int8 marisa_uint8;
21
- typedef unsigned __int16 marisa_uint16;
22
- typedef unsigned __int32 marisa_uint32;
23
- typedef unsigned __int64 marisa_uint64;
24
- #else // _MSC_VER
25
- typedef uint8_t marisa_uint8;
26
- typedef uint16_t marisa_uint16;
27
- typedef uint32_t marisa_uint32;
28
- typedef uint64_t marisa_uint64;
29
- #endif // _MSC_VER
30
-
31
- #if defined(_WIN64) || defined(__amd64__) || defined(__x86_64__) || \
32
- defined(__ia64__) || defined(__ppc64__) || defined(__powerpc64__) || \
33
- defined(__sparc64__) || defined(__mips64__) || defined(__aarch64__)
34
- #define MARISA_WORD_SIZE 64
35
- #else // defined(_WIN64), etc.
36
- #define MARISA_WORD_SIZE 32
37
- #endif // defined(_WIN64), etc.
38
-
39
- //#define MARISA_WORD_SIZE (sizeof(void *) * 8)
40
-
41
- #define MARISA_UINT8_MAX ((marisa_uint8)~(marisa_uint8)0)
42
- #define MARISA_UINT16_MAX ((marisa_uint16)~(marisa_uint16)0)
43
- #define MARISA_UINT32_MAX ((marisa_uint32)~(marisa_uint32)0)
44
- #define MARISA_UINT64_MAX ((marisa_uint64)~(marisa_uint64)0)
45
- #define MARISA_SIZE_MAX ((size_t)~(size_t)0)
46
-
47
- #define MARISA_INVALID_LINK_ID MARISA_UINT32_MAX
48
- #define MARISA_INVALID_KEY_ID MARISA_UINT32_MAX
49
- #define MARISA_INVALID_EXTRA (MARISA_UINT32_MAX >> 8)
50
-
51
- // Error codes are defined as members of marisa_error_code. This library throws
52
- // an exception with one of the error codes when an error occurs.
53
- typedef enum marisa_error_code_ {
54
- // MARISA_OK means that a requested operation has succeeded. In practice, an
55
- // exception never has MARISA_OK because it is not an error.
56
- MARISA_OK = 0,
57
-
58
- // MARISA_STATE_ERROR means that an object was not ready for a requested
59
- // operation. For example, an operation to modify a fixed vector throws an
60
- // exception with MARISA_STATE_ERROR.
61
- MARISA_STATE_ERROR = 1,
62
-
63
- // MARISA_NULL_ERROR means that an invalid NULL pointer has been given.
64
- MARISA_NULL_ERROR = 2,
65
-
66
- // MARISA_BOUND_ERROR means that an operation has tried to access an out of
67
- // range address.
68
- MARISA_BOUND_ERROR = 3,
69
-
70
- // MARISA_RANGE_ERROR means that an out of range value has appeared in
71
- // operation.
72
- MARISA_RANGE_ERROR = 4,
73
-
74
- // MARISA_CODE_ERROR means that an undefined code has appeared in operation.
75
- MARISA_CODE_ERROR = 5,
76
-
77
- // MARISA_RESET_ERROR means that a smart pointer has tried to reset itself.
78
- MARISA_RESET_ERROR = 6,
79
-
80
- // MARISA_SIZE_ERROR means that a size has exceeded a library limitation.
81
- MARISA_SIZE_ERROR = 7,
82
-
83
- // MARISA_MEMORY_ERROR means that a memory allocation has failed.
84
- MARISA_MEMORY_ERROR = 8,
85
-
86
- // MARISA_IO_ERROR means that an I/O operation has failed.
87
- MARISA_IO_ERROR = 9,
88
-
89
- // MARISA_FORMAT_ERROR means that input was in invalid format.
90
- MARISA_FORMAT_ERROR = 10,
91
- } marisa_error_code;
92
-
93
- // Min/max values, flags and masks for dictionary settings are defined below.
94
- // Please note that unspecified settings will be replaced with the default
95
- // settings. For example, 0 is equivalent to (MARISA_DEFAULT_NUM_TRIES |
96
- // MARISA_DEFAULT_TRIE | MARISA_DEFAULT_TAIL | MARISA_DEFAULT_ORDER).
97
-
98
- // A dictionary consists of 3 tries in default. Usually more tries make a
99
- // dictionary space-efficient but time-inefficient.
100
- typedef enum marisa_num_tries_ {
101
- MARISA_MIN_NUM_TRIES = 0x00001,
102
- MARISA_MAX_NUM_TRIES = 0x0007F,
103
- MARISA_DEFAULT_NUM_TRIES = 0x00003,
104
- } marisa_num_tries;
105
-
106
- // This library uses a cache technique to accelerate search functions. The
107
- // following enumerated type marisa_cache_level gives a list of available cache
108
- // size options. A larger cache enables faster search but takes a more space.
109
- typedef enum marisa_cache_level_ {
110
- MARISA_HUGE_CACHE = 0x00080,
111
- MARISA_LARGE_CACHE = 0x00100,
112
- MARISA_NORMAL_CACHE = 0x00200,
113
- MARISA_SMALL_CACHE = 0x00400,
114
- MARISA_TINY_CACHE = 0x00800,
115
- MARISA_DEFAULT_CACHE = MARISA_NORMAL_CACHE
116
- } marisa_cache_level;
117
-
118
- // This library provides 2 kinds of TAIL implementations.
119
- typedef enum marisa_tail_mode_ {
120
- // MARISA_TEXT_TAIL merges last labels as zero-terminated strings. So, it is
121
- // available if and only if the last labels do not contain a NULL character.
122
- // If MARISA_TEXT_TAIL is specified and a NULL character exists in the last
123
- // labels, the setting is automatically switched to MARISA_BINARY_TAIL.
124
- MARISA_TEXT_TAIL = 0x01000,
125
-
126
- // MARISA_BINARY_TAIL also merges last labels but as byte sequences. It uses
127
- // a bit vector to detect the end of a sequence, instead of NULL characters.
128
- // So, MARISA_BINARY_TAIL requires a larger space if the average length of
129
- // labels is greater than 8.
130
- MARISA_BINARY_TAIL = 0x02000,
131
-
132
- MARISA_DEFAULT_TAIL = MARISA_TEXT_TAIL,
133
- } marisa_tail_mode;
134
-
135
- // The arrangement of nodes affects the time cost of matching and the order of
136
- // predictive search.
137
- typedef enum marisa_node_order_ {
138
- // MARISA_LABEL_ORDER arranges nodes in ascending label order.
139
- // MARISA_LABEL_ORDER is useful if an application needs to predict keys in
140
- // label order.
141
- MARISA_LABEL_ORDER = 0x10000,
142
-
143
- // MARISA_WEIGHT_ORDER arranges nodes in descending weight order.
144
- // MARISA_WEIGHT_ORDER is generally a better choice because it enables faster
145
- // matching.
146
- MARISA_WEIGHT_ORDER = 0x20000,
147
-
148
- MARISA_DEFAULT_ORDER = MARISA_WEIGHT_ORDER,
149
- } marisa_node_order;
150
-
151
- typedef enum marisa_config_mask_ {
152
- MARISA_NUM_TRIES_MASK = 0x0007F,
153
- MARISA_CACHE_LEVEL_MASK = 0x00F80,
154
- MARISA_TAIL_MODE_MASK = 0x0F000,
155
- MARISA_NODE_ORDER_MASK = 0xF0000,
156
- MARISA_CONFIG_MASK = 0xFFFFF
157
- } marisa_config_mask;
158
-
159
- #ifdef __cplusplus
160
- } // extern "C"
161
- #endif // __cplusplus
162
-
163
- #ifdef __cplusplus
164
- namespace marisa {
165
-
166
- typedef ::marisa_uint8 UInt8;
167
- typedef ::marisa_uint16 UInt16;
168
- typedef ::marisa_uint32 UInt32;
169
- typedef ::marisa_uint64 UInt64;
170
-
171
- typedef ::marisa_error_code ErrorCode;
172
-
173
- typedef ::marisa_cache_level CacheLevel;
174
- typedef ::marisa_tail_mode TailMode;
175
- typedef ::marisa_node_order NodeOrder;
176
-
177
- template <typename T>
178
- inline void swap(T &lhs, T &rhs) {
179
- T temp = lhs;
180
- lhs = rhs;
181
- rhs = temp;
182
- }
183
-
184
- } // namespace marisa
185
- #endif // __cplusplus
186
-
187
- #ifdef __cplusplus
188
- #include "exception.h"
189
- #include "scoped-ptr.h"
190
- #include "scoped-array.h"
191
- #endif // __cplusplus
192
-
193
- #endif // MARISA_BASE_H_
@@ -1,82 +0,0 @@
1
- #ifndef MARISA_EXCEPTION_H_
2
- #define MARISA_EXCEPTION_H_
3
-
4
- #include <exception>
5
-
6
- #include "base.h"
7
-
8
- namespace marisa {
9
-
10
- // An exception object keeps a filename, a line number, an error code and an
11
- // error message. The message format is as follows:
12
- // "__FILE__:__LINE__: error_code: error_message"
13
- class Exception : public std::exception {
14
- public:
15
- Exception(const char *filename, int line,
16
- ErrorCode error_code, const char *error_message)
17
- : std::exception(), filename_(filename), line_(line),
18
- error_code_(error_code), error_message_(error_message) {}
19
- Exception(const Exception &ex)
20
- : std::exception(), filename_(ex.filename_), line_(ex.line_),
21
- error_code_(ex.error_code_), error_message_(ex.error_message_) {}
22
- virtual ~Exception() throw() {}
23
-
24
- Exception &operator=(const Exception &rhs) {
25
- filename_ = rhs.filename_;
26
- line_ = rhs.line_;
27
- error_code_ = rhs.error_code_;
28
- error_message_ = rhs.error_message_;
29
- return *this;
30
- }
31
-
32
- const char *filename() const {
33
- return filename_;
34
- }
35
- int line() const {
36
- return line_;
37
- }
38
- ErrorCode error_code() const {
39
- return error_code_;
40
- }
41
- const char *error_message() const {
42
- return error_message_;
43
- }
44
-
45
- virtual const char *what() const throw() {
46
- return error_message_;
47
- }
48
-
49
- private:
50
- const char *filename_;
51
- int line_;
52
- ErrorCode error_code_;
53
- const char *error_message_;
54
- };
55
-
56
- // These macros are used to convert a line number to a string constant.
57
- #define MARISA_INT_TO_STR(value) #value
58
- #define MARISA_LINE_TO_STR(line) MARISA_INT_TO_STR(line)
59
- #define MARISA_LINE_STR MARISA_LINE_TO_STR(__LINE__)
60
-
61
- // MARISA_THROW throws an exception with a filename, a line number, an error
62
- // code and an error message. The message format is as follows:
63
- // "__FILE__:__LINE__: error_code: error_message"
64
- #define MARISA_THROW(error_code, error_message) \
65
- (throw marisa::Exception(__FILE__, __LINE__, error_code, \
66
- __FILE__ ":" MARISA_LINE_STR ": " #error_code ": " error_message))
67
-
68
- // MARISA_THROW_IF throws an exception if `condition' is true.
69
- #define MARISA_THROW_IF(condition, error_code) \
70
- (void)((!(condition)) || (MARISA_THROW(error_code, #condition), 0))
71
-
72
- // MARISA_DEBUG_IF is ignored if _DEBUG is undefined. So, it is useful for
73
- // debugging time-critical codes.
74
- #ifdef _DEBUG
75
- #define MARISA_DEBUG_IF(cond, error_code) MARISA_THROW_IF(cond, error_code)
76
- #else
77
- #define MARISA_DEBUG_IF(cond, error_code)
78
- #endif
79
-
80
- } // namespace marisa
81
-
82
- #endif // MARISA_EXCEPTION_H_
@@ -1,18 +0,0 @@
1
- #ifndef MARISA_IOSTREAM_H_
2
- #define MARISA_IOSTREAM_H_
3
-
4
- #include <iosfwd>
5
-
6
- namespace marisa {
7
-
8
- class Trie;
9
-
10
- std::istream &read(std::istream &stream, Trie *trie);
11
- std::ostream &write(std::ostream &stream, const Trie &trie);
12
-
13
- std::istream &operator>>(std::istream &stream, Trie &trie);
14
- std::ostream &operator<<(std::ostream &stream, const Trie &trie);
15
-
16
- } // namespace marisa
17
-
18
- #endif // MARISA_IOSTREAM_H_
@@ -1,85 +0,0 @@
1
- #ifndef MARISA_KEY_H_
2
- #define MARISA_KEY_H_
3
-
4
- #include "base.h"
5
-
6
- namespace marisa {
7
-
8
- class Key {
9
- public:
10
- Key() : ptr_(NULL), length_(0), union_() {
11
- union_.id = 0;
12
- }
13
- Key(const Key &key)
14
- : ptr_(key.ptr_), length_(key.length_), union_(key.union_) {}
15
-
16
- Key &operator=(const Key &key) {
17
- ptr_ = key.ptr_;
18
- length_ = key.length_;
19
- union_ = key.union_;
20
- return *this;
21
- }
22
-
23
- char operator[](std::size_t i) const {
24
- MARISA_DEBUG_IF(i >= length_, MARISA_BOUND_ERROR);
25
- return ptr_[i];
26
- }
27
-
28
- void set_str(const char *str) {
29
- MARISA_DEBUG_IF(str == NULL, MARISA_NULL_ERROR);
30
- std::size_t length = 0;
31
- while (str[length] != '\0') {
32
- ++length;
33
- }
34
- MARISA_DEBUG_IF(length > MARISA_UINT32_MAX, MARISA_SIZE_ERROR);
35
- ptr_ = str;
36
- length_ = (UInt32)length;
37
- }
38
- void set_str(const char *ptr, std::size_t length) {
39
- MARISA_DEBUG_IF((ptr == NULL) && (length != 0), MARISA_NULL_ERROR);
40
- MARISA_DEBUG_IF(length > MARISA_UINT32_MAX, MARISA_SIZE_ERROR);
41
- ptr_ = ptr;
42
- length_ = (UInt32)length;
43
- }
44
- void set_id(std::size_t id) {
45
- MARISA_DEBUG_IF(id > MARISA_UINT32_MAX, MARISA_SIZE_ERROR);
46
- union_.id = (UInt32)id;
47
- }
48
- void set_weight(float weight) {
49
- union_.weight = weight;
50
- }
51
-
52
- const char *ptr() const {
53
- return ptr_;
54
- }
55
- std::size_t length() const {
56
- return length_;
57
- }
58
- std::size_t id() const {
59
- return union_.id;
60
- }
61
- float weight() const {
62
- return union_.weight;
63
- }
64
-
65
- void clear() {
66
- Key().swap(*this);
67
- }
68
- void swap(Key &rhs) {
69
- marisa::swap(ptr_, rhs.ptr_);
70
- marisa::swap(length_, rhs.length_);
71
- marisa::swap(union_.id, rhs.union_.id);
72
- }
73
-
74
- private:
75
- const char *ptr_;
76
- UInt32 length_;
77
- union Union {
78
- UInt32 id;
79
- float weight;
80
- } union_;
81
- };
82
-
83
- } // namespace marisa
84
-
85
- #endif // MARISA_KEY_H_
@@ -1,80 +0,0 @@
1
- #ifndef MARISA_KEYSET_H_
2
- #define MARISA_KEYSET_H_
3
-
4
- #include "key.h"
5
-
6
- namespace marisa {
7
-
8
- class Keyset {
9
- public:
10
- enum {
11
- BASE_BLOCK_SIZE = 4096,
12
- EXTRA_BLOCK_SIZE = 1024,
13
- KEY_BLOCK_SIZE = 256
14
- };
15
-
16
- Keyset();
17
-
18
- void push_back(const Key &key);
19
- void push_back(const Key &key, char end_marker);
20
-
21
- void push_back(const char *str);
22
- void push_back(const char *ptr, std::size_t length, float weight = 1.0);
23
-
24
- const Key &operator[](std::size_t i) const {
25
- MARISA_DEBUG_IF(i >= size_, MARISA_BOUND_ERROR);
26
- return key_blocks_[i / KEY_BLOCK_SIZE][i % KEY_BLOCK_SIZE];
27
- }
28
- Key &operator[](std::size_t i) {
29
- MARISA_DEBUG_IF(i >= size_, MARISA_BOUND_ERROR);
30
- return key_blocks_[i / KEY_BLOCK_SIZE][i % KEY_BLOCK_SIZE];
31
- }
32
-
33
- std::size_t num_keys() const {
34
- return size_;
35
- }
36
-
37
- bool empty() const {
38
- return size_ == 0;
39
- }
40
- std::size_t size() const {
41
- return size_;
42
- }
43
- std::size_t total_length() const {
44
- return total_length_;
45
- }
46
-
47
- void reset();
48
-
49
- void clear();
50
- void swap(Keyset &rhs);
51
-
52
- private:
53
- scoped_array<scoped_array<char> > base_blocks_;
54
- std::size_t base_blocks_size_;
55
- std::size_t base_blocks_capacity_;
56
- scoped_array<scoped_array<char> > extra_blocks_;
57
- std::size_t extra_blocks_size_;
58
- std::size_t extra_blocks_capacity_;
59
- scoped_array<scoped_array<Key> > key_blocks_;
60
- std::size_t key_blocks_size_;
61
- std::size_t key_blocks_capacity_;
62
- char *ptr_;
63
- std::size_t avail_;
64
- std::size_t size_;
65
- std::size_t total_length_;
66
-
67
- char *reserve(std::size_t size);
68
-
69
- void append_base_block();
70
- void append_extra_block(std::size_t size);
71
- void append_key_block();
72
-
73
- // Disallows copy and assignment.
74
- Keyset(const Keyset &);
75
- Keyset &operator=(const Keyset &);
76
- };
77
-
78
- } // namespace marisa
79
-
80
- #endif // MARISA_KEYSET_H_
@@ -1,71 +0,0 @@
1
- #ifndef MARISA_QUERY_H_
2
- #define MARISA_QUERY_H_
3
-
4
- #include "base.h"
5
-
6
- namespace marisa {
7
-
8
- class Query {
9
- public:
10
- Query() : ptr_(NULL), length_(0), id_(0) {}
11
- Query(const Query &query)
12
- : ptr_(query.ptr_), length_(query.length_), id_(query.id_) {}
13
-
14
- Query &operator=(const Query &query) {
15
- ptr_ = query.ptr_;
16
- length_ = query.length_;
17
- id_ = query.id_;
18
- return *this;
19
- }
20
-
21
- char operator[](std::size_t i) const {
22
- MARISA_DEBUG_IF(i >= length_, MARISA_BOUND_ERROR);
23
- return ptr_[i];
24
- }
25
-
26
- void set_str(const char *str) {
27
- MARISA_DEBUG_IF(str == NULL, MARISA_NULL_ERROR);
28
- std::size_t length = 0;
29
- while (str[length] != '\0') {
30
- ++length;
31
- }
32
- ptr_ = str;
33
- length_ = length;
34
- }
35
- void set_str(const char *ptr, std::size_t length) {
36
- MARISA_DEBUG_IF((ptr == NULL) && (length != 0), MARISA_NULL_ERROR);
37
- ptr_ = ptr;
38
- length_ = length;
39
- }
40
- void set_id(std::size_t id) {
41
- id_ = id;
42
- }
43
-
44
- const char *ptr() const {
45
- return ptr_;
46
- }
47
- std::size_t length() const {
48
- return length_;
49
- }
50
- std::size_t id() const {
51
- return id_;
52
- }
53
-
54
- void clear() {
55
- Query().swap(*this);
56
- }
57
- void swap(Query &rhs) {
58
- marisa::swap(ptr_, rhs.ptr_);
59
- marisa::swap(length_, rhs.length_);
60
- marisa::swap(id_, rhs.id_);
61
- }
62
-
63
- private:
64
- const char *ptr_;
65
- std::size_t length_;
66
- std::size_t id_;
67
- };
68
-
69
- } // namespace marisa
70
-
71
- #endif // MARISA_QUERY_H_
@@ -1,48 +0,0 @@
1
- #ifndef MARISA_SCOPED_ARRAY_H_
2
- #define MARISA_SCOPED_ARRAY_H_
3
-
4
- #include "base.h"
5
-
6
- namespace marisa {
7
-
8
- template <typename T>
9
- class scoped_array {
10
- public:
11
- scoped_array() : array_(NULL) {}
12
- explicit scoped_array(T *array) : array_(array) {}
13
-
14
- ~scoped_array() {
15
- delete [] array_;
16
- }
17
-
18
- void reset(T *array = NULL) {
19
- MARISA_THROW_IF((array != NULL) && (array == array_), MARISA_RESET_ERROR);
20
- scoped_array(array).swap(*this);
21
- }
22
-
23
- T &operator[](std::size_t i) const {
24
- MARISA_DEBUG_IF(array_ == NULL, MARISA_STATE_ERROR);
25
- return array_[i];
26
- }
27
- T *get() const {
28
- return array_;
29
- }
30
-
31
- void clear() {
32
- scoped_array().swap(*this);
33
- }
34
- void swap(scoped_array &rhs) {
35
- marisa::swap(array_, rhs.array_);
36
- }
37
-
38
- private:
39
- T *array_;
40
-
41
- // Disallows copy and assignment.
42
- scoped_array(const scoped_array &);
43
- scoped_array &operator=(const scoped_array &);
44
- };
45
-
46
- } // namespace marisa
47
-
48
- #endif // MARISA_SCOPED_ARRAY_H_
@@ -1,52 +0,0 @@
1
- #ifndef MARISA_SCOPED_PTR_H_
2
- #define MARISA_SCOPED_PTR_H_
3
-
4
- #include "base.h"
5
-
6
- namespace marisa {
7
-
8
- template <typename T>
9
- class scoped_ptr {
10
- public:
11
- scoped_ptr() : ptr_(NULL) {}
12
- explicit scoped_ptr(T *ptr) : ptr_(ptr) {}
13
-
14
- ~scoped_ptr() {
15
- delete ptr_;
16
- }
17
-
18
- void reset(T *ptr = NULL) {
19
- MARISA_THROW_IF((ptr != NULL) && (ptr == ptr_), MARISA_RESET_ERROR);
20
- scoped_ptr(ptr).swap(*this);
21
- }
22
-
23
- T &operator*() const {
24
- MARISA_DEBUG_IF(ptr_ == NULL, MARISA_STATE_ERROR);
25
- return *ptr_;
26
- }
27
- T *operator->() const {
28
- MARISA_DEBUG_IF(ptr_ == NULL, MARISA_STATE_ERROR);
29
- return ptr_;
30
- }
31
- T *get() const {
32
- return ptr_;
33
- }
34
-
35
- void clear() {
36
- scoped_ptr().swap(*this);
37
- }
38
- void swap(scoped_ptr &rhs) {
39
- marisa::swap(ptr_, rhs.ptr_);
40
- }
41
-
42
- private:
43
- T *ptr_;
44
-
45
- // Disallows copy and assignment.
46
- scoped_ptr(const scoped_ptr &);
47
- scoped_ptr &operator=(const scoped_ptr &);
48
- };
49
-
50
- } // namespace marisa
51
-
52
- #endif // MARISA_SCOPED_PTR_H_
@@ -1,15 +0,0 @@
1
- #ifndef MARISA_STDIO_H_
2
- #define MARISA_STDIO_H_
3
-
4
- #include <cstdio>
5
-
6
- namespace marisa {
7
-
8
- class Trie;
9
-
10
- void fread(std::FILE *file, Trie *trie);
11
- void fwrite(std::FILE *file, const Trie &trie);
12
-
13
- } // namespace marisa
14
-
15
- #endif // MARISA_STDIO_H_
@@ -1,64 +0,0 @@
1
- #ifndef MARISA_TRIE_H_
2
- #define MARISA_TRIE_H_
3
-
4
- #include "keyset.h"
5
- #include "agent.h"
6
-
7
- namespace marisa {
8
- namespace grimoire {
9
- namespace trie {
10
-
11
- class LoudsTrie;
12
-
13
- } // namespace trie
14
- } // namespace grimoire
15
-
16
- class Trie {
17
- friend class TrieIO;
18
-
19
- public:
20
- Trie();
21
- ~Trie();
22
-
23
- void build(Keyset &keyset, int config_flags = 0);
24
-
25
- void mmap(const char *filename);
26
- void map(const void *ptr, std::size_t size);
27
-
28
- void load(const char *filename);
29
- void read(int fd);
30
-
31
- void save(const char *filename) const;
32
- void write(int fd) const;
33
-
34
- bool lookup(Agent &agent) const;
35
- void reverse_lookup(Agent &agent) const;
36
- bool common_prefix_search(Agent &agent) const;
37
- bool predictive_search(Agent &agent) const;
38
-
39
- std::size_t num_tries() const;
40
- std::size_t num_keys() const;
41
- std::size_t num_nodes() const;
42
-
43
- TailMode tail_mode() const;
44
- NodeOrder node_order() const;
45
-
46
- bool empty() const;
47
- std::size_t size() const;
48
- std::size_t total_size() const;
49
- std::size_t io_size() const;
50
-
51
- void clear();
52
- void swap(Trie &rhs);
53
-
54
- private:
55
- scoped_ptr<grimoire::trie::LoudsTrie> trie_;
56
-
57
- // Disallows copy and assignment.
58
- Trie(const Trie &);
59
- Trie &operator=(const Trie &);
60
- };
61
-
62
- } // namespace marisa
63
-
64
- #endif // MARISA_TRIE_H_
@@ -1,41 +0,0 @@
1
- # libmarisa.la - a libtool library file
2
- # Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1ubuntu1
3
- #
4
- # Please DO NOT delete this file!
5
- # It is necessary for linking the library.
6
-
7
- # The name that we can dlopen(3).
8
- dlname='libmarisa.0.dylib'
9
-
10
- # Names of this library.
11
- library_names='libmarisa.0.dylib libmarisa.dylib'
12
-
13
- # The name of the static archive.
14
- old_library='libmarisa.a'
15
-
16
- # Linker flags that can not go in dependency_libs.
17
- inherited_linker_flags=' '
18
-
19
- # Libraries that this one depends upon.
20
- dependency_libs=''
21
-
22
- # Names of additional weak libraries provided by this library
23
- weak_library_names=''
24
-
25
- # Version information for libmarisa.
26
- current=0
27
- age=0
28
- revision=0
29
-
30
- # Is this an already installed library?
31
- installed=yes
32
-
33
- # Should we warn about portability when linking against -modules?
34
- shouldnotlink=no
35
-
36
- # Files to dlopen/dlpreopen
37
- dlopen=''
38
- dlpreopen=''
39
-
40
- # Directory that this library needs to be installed in:
41
- libdir='/Users/duane/Dropbox/Projects/wordtree/melisa/ext/marisa-0.2.4/pkg/lib'
@@ -1,11 +0,0 @@
1
- prefix=/Users/duane/Dropbox/Projects/wordtree/melisa/ext/marisa-0.2.4/pkg
2
- exec_prefix=${prefix}
3
- bindir=/Users/duane/Dropbox/Projects/wordtree/melisa/bin
4
- libdir=${exec_prefix}/lib
5
- includedir=${prefix}/include
6
-
7
- Name: Marisa
8
- Description: Matching Algorithm with Recursively Implemented StorAge
9
- Version: 0.2.4
10
- Cflags: -I${includedir}
11
- Libs: -L${libdir} -lmarisa