suffix_tree 0.0.1

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 (46) hide show
  1. checksums.yaml +7 -0
  2. data/lib/data/base_data_source.rb +44 -0
  3. data/lib/data/data_source_factory.rb +16 -0
  4. data/lib/data/file_data_source.rb +29 -0
  5. data/lib/data/line_state_machine.rb +86 -0
  6. data/lib/data/string_data_source.rb +31 -0
  7. data/lib/data/word_data_source.rb +229 -0
  8. data/lib/location.rb +165 -0
  9. data/lib/node.rb +63 -0
  10. data/lib/node_factory.rb +169 -0
  11. data/lib/persist/suffix_tree_db.rb +148 -0
  12. data/lib/search/searcher.rb +68 -0
  13. data/lib/suffix_linker.rb +16 -0
  14. data/lib/suffix_tree.rb +122 -0
  15. data/lib/visitor/base_visitor.rb +17 -0
  16. data/lib/visitor/bfs.rb +22 -0
  17. data/lib/visitor/data_source_visitor.rb +15 -0
  18. data/lib/visitor/dfs.rb +34 -0
  19. data/lib/visitor/k_common_visitor.rb +71 -0
  20. data/lib/visitor/leaf_count_visitor.rb +15 -0
  21. data/lib/visitor/node_count_visitor.rb +16 -0
  22. data/lib/visitor/numbering_visitor.rb +230 -0
  23. data/lib/visitor/suffix_offset_visitor.rb +23 -0
  24. data/lib/visitor/tree_print_visitor.rb +44 -0
  25. data/lib/visitor/value_depth_visitor.rb +34 -0
  26. data/spec/constant_lca_spec.rb +27 -0
  27. data/spec/data_source_spec.rb +51 -0
  28. data/spec/fixtures/arizona.txt +1 -0
  29. data/spec/fixtures/chapter1.txt +371 -0
  30. data/spec/fixtures/chapter1.txt.summary +3 -0
  31. data/spec/fixtures/chapter1.txt.values +0 -0
  32. data/spec/fixtures/chapter1.txt.words +1329 -0
  33. data/spec/fixtures/mississippi.txt +1 -0
  34. data/spec/fixtures/singlePara.txt +41 -0
  35. data/spec/fixtures/smallFile.txt +3 -0
  36. data/spec/fixtures/smallFile.txt.summary +2 -0
  37. data/spec/fixtures/smallFile.txt.values +0 -0
  38. data/spec/fixtures/smallFile.txt.words +14 -0
  39. data/spec/fixtures/testbook.txt +5414 -0
  40. data/spec/location_spec.rb +149 -0
  41. data/spec/node_factory_spec.rb +199 -0
  42. data/spec/search_spec.rb +182 -0
  43. data/spec/suffix_tree_spec.rb +270 -0
  44. data/spec/util_spec.rb +47 -0
  45. data/spec/visitor_spec.rb +310 -0
  46. metadata +87 -0
@@ -0,0 +1 @@
1
+ mississippi
@@ -0,0 +1,41 @@
1
+ I was born in the ancient town of Angora, Asia Minor, famous not alone
2
+ for its silky-haired cats and goats, but also for its historical and
3
+ archæological importance, and with it my memories of early days, and
4
+ therefore the pages of my desultory journal, naturally begin. Men
5
+ of learning who have engaged in researches into the archæology and
6
+ biblical history of Asia Minor have come to the conclusion that this
7
+ town was once in the remote past the principal centre of a wandering
8
+ branch of the Celtic peoples who ultimately settled in Asia Minor.
9
+ Although, of course, it was conquered and held during later generations
10
+ by the Eastern invaders, it is even nowadays noticeable that there
11
+ is a difference, both of character and physique, between most of
12
+ the inhabitants of our province and those of other provinces, more
13
+ especially of Southern and Eastern Asia Minor. By remarking on this I
14
+ do not wish to seem to be trying to trace my origin to a European race,
15
+ though I am aware that many people in this country are unsympathetic,
16
+ and even, perhaps, prejudiced, where Orientals are concerned. My
17
+ paternal ancestors came across from Central Asia, and first settled in
18
+ Khorassan, in Persia. But as they were devout followers of the orthodox
19
+ creed of the Arabian Prophet they were subjected to the intolerant
20
+ oppression of the Persian Moslems, between whom and the orthodox
21
+ believers the history of Western Asia records many a sanguinary
22
+ feud, the result of their doctrinal antagonism. My ancestors were
23
+ compelled eventually to emigrate to Asia Minor over a hundred and
24
+ fifty years ago, and there they found a more hospitable reception. My
25
+ great-grandfather was the sheikh or head of a religious order called
26
+ _Halvati_, or, to give the name an English equivalent, "those who
27
+ worship in seclusion." The name arises from one of the strict rules
28
+ of the order, that its rites must not be displayed to the outside
29
+ public, doubtless a measure for the prevention of hypocrisy. Historical
30
+ research has traced the foundation of the order to Ali, the son-in-law
31
+ of Mohammed. Shortly after settling in Asia Minor the disciples of
32
+ the great sheikh increased to a number approaching eighty thousand,
33
+ and pilgrims came to his monastic dwelling from all the neighbouring
34
+ provinces. It was not only in Anatolia and Syria that his name was
35
+ honoured; he is mentioned with reverence in the books written in Egypt
36
+ at that time. It must not be imagined that he was a kind of _Mahdi_,
37
+ a name which is familiar in England on account of its having been
38
+ assumed by the late pretender in the Soudan. In the days gone by many
39
+ such Mahdis, or "redeemers," appeared in Western Asia and the Northern
40
+ half of Africa, disguising under this apostolic name their ambition of
41
+ attaining temporal power and worldly glory.
@@ -0,0 +1,3 @@
1
+ This is a small test file.
2
+ As a small test file, it has a few repeats.
3
+ But otherwise is a very small file.
@@ -0,0 +1,2 @@
1
+ 23 words in file
2
+ 14 distinct words
Binary file
@@ -0,0 +1,14 @@
1
+ this
2
+ is
3
+ a
4
+ small
5
+ test
6
+ file
7
+ as
8
+ it
9
+ has
10
+ few
11
+ repeats
12
+ but
13
+ otherwise
14
+ very