Permalink
Browse files

Merge branch 'documentation' into develop

  • Loading branch information...
2 parents 61f5944 + 6c70968 commit 790b8e42b1e6bc775ea2851c129ca48ff4f785e9 @arbox committed Feb 14, 2012
Showing with 42 additions and 1 deletion.
  1. +1 −1 README.rdoc
  2. +5 −0 lib/tree_tagger/tagger.rb
  3. +36 −0 test/test_tagger.rb
View
@@ -91,7 +91,7 @@ information on lexical classes of tokens and on their probabilities. Every token
has to be on a separate line. Due to technical limitations SGML tags
(i.e. sequences with heading < and trailing >) cannot be valid tokes since
they are used internally for delimiting meaningful content from flush tokens.
-In implies the use of the <tt>-sgml</tt> option which cannot be changes by user.
+It implies the use of the <tt>-sgml</tt> option which cannot be changes by user.
It is a limitation of <em>this</em> library. If you do need to process tags,
fall back and use the TreeTagger as a standalone programm possibly employing
temp files to store your input and output. This behaviour will be also
@@ -13,7 +13,11 @@
- Store the queue on a persistant medium, not in the memory.
- Properly set the $ORS for all platforms.
=end
+# :main: README.rdoc
+# :title: TreeTagger - Ruby based Wrapper for the TreeTagger by Helmut Schmid
+# Module comment
module TreeTagger
+ # Class comment
class Tagger
BEGIN_MARKER = '<BEGIN_OF_THE_TT_INPUT />'
@@ -26,6 +30,7 @@ class Tagger
# ENV['TREETAGGER_MODEL'] = '/opt/TreeTagger/lib/german.par'
# ENV['TREETAGGER_LEXICON'] = '/opt/TreeTagger/lib/german-lexicon.txt'
+ # Initializer commet
def initialize(opts = {
:binary => nil,
:model => nil,
View
@@ -34,7 +34,43 @@ def test_public_methods
def test_tagger
end
+
+ # It should accept only arrays and strings.
+ def test_input_for_its_class
+ assert_nothing_raised do
+ @tagger.process 'Ich\ngehe\nin\ndie\nSchule\n.\n'
+ @tagger.process %w{Ich gehe in die Schule .}
+ end
+ end
+
+ # It should reject non-string and non-array elements.
+ def test_rejecting_invalid_input
+ [{}, :input, 1, 1.0, Time.new].each do |input|
+ assert_raise(TreeTagger::UserError) do
+ @tagger.process(input)
+ end
+ end
+ end
+
+ # It should reject empty input.
+ def test_for_empty_input
+ ['', []].each do |input|
+ assert_raise(TreeTagger::UserError) do
+ @tagger.process(input)
+ end
+ end
+ end
+ # It should reject arrays with wrong elements.
+ def test_for_elements_of_arrays
+
+ end
+
+ # It should accept valid input.
+ def test_accepting_vaild_input
+ input = ''
+ end
+
# It should accept only valid input.
def test_input_validity
['', [], {}, :input, [:one, :two]].each do |input|

0 comments on commit 790b8e4

Please sign in to comment.