shalmaneser-lib 1.2.rc5
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.
- checksums.yaml +7 -0
- data/.yardopts +10 -0
- data/CHANGELOG.md +4 -0
- data/LICENSE.md +4 -0
- data/README.md +122 -0
- data/lib/configuration/config_data.rb +457 -0
- data/lib/configuration/config_format_element.rb +210 -0
- data/lib/configuration/configuration_error.rb +15 -0
- data/lib/configuration/external_config_data.rb +56 -0
- data/lib/configuration/frappe_config_data.rb +134 -0
- data/lib/configuration/fred_config_data.rb +199 -0
- data/lib/configuration/rosy_config_data.rb +126 -0
- data/lib/db/db_interface.rb +50 -0
- data/lib/db/db_mysql.rb +141 -0
- data/lib/db/db_sqlite.rb +280 -0
- data/lib/db/db_table.rb +237 -0
- data/lib/db/db_view.rb +416 -0
- data/lib/db/db_wrapper.rb +175 -0
- data/lib/db/select_table_and_columns.rb +10 -0
- data/lib/db/sql_query.rb +243 -0
- data/lib/definitions.rb +19 -0
- data/lib/eval.rb +482 -0
- data/lib/ext/maxent/Classify.class +0 -0
- data/lib/ext/maxent/Train.class +0 -0
- data/lib/external_systems.rb +251 -0
- data/lib/framenet_format/fn_corpus_aset.rb +209 -0
- data/lib/framenet_format/fn_corpus_xml_file.rb +120 -0
- data/lib/framenet_format/fn_corpus_xml_sentence.rb +299 -0
- data/lib/framenet_format/fn_database.rb +143 -0
- data/lib/framenet_format/frame_xml_file.rb +104 -0
- data/lib/framenet_format/frame_xml_sentence.rb +411 -0
- data/lib/logging.rb +25 -0
- data/lib/ml/classifier.rb +189 -0
- data/lib/ml/mallet.rb +236 -0
- data/lib/ml/maxent.rb +229 -0
- data/lib/ml/optimize.rb +195 -0
- data/lib/ml/timbl.rb +140 -0
- data/lib/monkey_patching/array.rb +82 -0
- data/lib/monkey_patching/enumerable_bool.rb +24 -0
- data/lib/monkey_patching/enumerable_distribute.rb +18 -0
- data/lib/monkey_patching/file.rb +131 -0
- data/lib/monkey_patching/subsumed.rb +24 -0
- data/lib/ruby_class_extensions.rb +4 -0
- data/lib/salsa_tiger_xml/corpus.rb +24 -0
- data/lib/salsa_tiger_xml/fe_node.rb +98 -0
- data/lib/salsa_tiger_xml/file_parts_parser.rb +214 -0
- data/lib/salsa_tiger_xml/frame_node.rb +145 -0
- data/lib/salsa_tiger_xml/graph_node.rb +347 -0
- data/lib/salsa_tiger_xml/reg_xml.rb +285 -0
- data/lib/salsa_tiger_xml/salsa_tiger_sentence.rb +596 -0
- data/lib/salsa_tiger_xml/salsa_tiger_sentence_graph.rb +333 -0
- data/lib/salsa_tiger_xml/salsa_tiger_sentence_sem.rb +438 -0
- data/lib/salsa_tiger_xml/salsa_tiger_xml_helper.rb +84 -0
- data/lib/salsa_tiger_xml/salsa_tiger_xml_node.rb +161 -0
- data/lib/salsa_tiger_xml/sem_node.rb +58 -0
- data/lib/salsa_tiger_xml/string_terminals_in_right_order.rb +192 -0
- data/lib/salsa_tiger_xml/syn_node.rb +169 -0
- data/lib/salsa_tiger_xml/tree_node.rb +59 -0
- data/lib/salsa_tiger_xml/ts_syn_node.rb +47 -0
- data/lib/salsa_tiger_xml/usp_node.rb +72 -0
- data/lib/salsa_tiger_xml/xml_node.rb +163 -0
- data/lib/shalmaneser/lib.rb +1 -0
- data/lib/tabular_format/fn_tab_format_file.rb +38 -0
- data/lib/tabular_format/fn_tab_frame.rb +67 -0
- data/lib/tabular_format/fn_tab_sentence.rb +169 -0
- data/lib/tabular_format/tab_format_file.rb +91 -0
- data/lib/tabular_format/tab_format_named_args.rb +184 -0
- data/lib/tabular_format/tab_format_sentence.rb +119 -0
- data/lib/value_restriction.rb +49 -0
- metadata +131 -0
@@ -0,0 +1,119 @@
|
|
1
|
+
require "ruby_class_extensions"
|
2
|
+
require_relative 'tab_format_named_args'
|
3
|
+
|
4
|
+
#################################################
|
5
|
+
# class for keeping and yielding one sentence
|
6
|
+
# in tabular format
|
7
|
+
class TabFormatSentence
|
8
|
+
############
|
9
|
+
# initialize:
|
10
|
+
# the sentence will be stored one word (plus additional info
|
11
|
+
# for that word) per line. Each line will be stored in a cell of
|
12
|
+
# the array @lines. the 'initialize' method starts with an empty
|
13
|
+
# array of lines.
|
14
|
+
def initialize(pattern)
|
15
|
+
@lines = []
|
16
|
+
@pattern = pattern
|
17
|
+
|
18
|
+
# this is just for inheritance; FNTabFormatSentence will need this
|
19
|
+
@group_no = nil
|
20
|
+
end
|
21
|
+
|
22
|
+
#####
|
23
|
+
# length: number of words in the sentence
|
24
|
+
def length
|
25
|
+
@lines.length
|
26
|
+
end
|
27
|
+
|
28
|
+
################3
|
29
|
+
# add_line:
|
30
|
+
# add one entry to the @lines array, i.e. information for one word
|
31
|
+
# of the sentence.
|
32
|
+
def add_line(line)
|
33
|
+
@lines << line
|
34
|
+
end
|
35
|
+
|
36
|
+
###################
|
37
|
+
# empty?:
|
38
|
+
# returns true if there are currently no lines stored in this
|
39
|
+
# TabFormatSentence object
|
40
|
+
# else false
|
41
|
+
def empty?
|
42
|
+
@lines.empty?
|
43
|
+
end
|
44
|
+
|
45
|
+
######################
|
46
|
+
# empty!:
|
47
|
+
# discards all entries to the @lines array,
|
48
|
+
# i.e. empties this TabFormatSentence object of all
|
49
|
+
# data
|
50
|
+
def empty!
|
51
|
+
@lines.clear
|
52
|
+
end
|
53
|
+
|
54
|
+
#####################
|
55
|
+
# each_line:
|
56
|
+
# yields each line of the sentence
|
57
|
+
# as a string
|
58
|
+
def each_line
|
59
|
+
@lines.each { |l| yield l }
|
60
|
+
end
|
61
|
+
|
62
|
+
######################
|
63
|
+
# each_line_parsed:
|
64
|
+
# yields each line of the sentence
|
65
|
+
# broken up as follows:
|
66
|
+
# the line is expected to contain 6 or more pieces of
|
67
|
+
# information, separated by whitespace.
|
68
|
+
# - the word
|
69
|
+
# - the part of speech info for the word
|
70
|
+
# - syntax for roles (not to be used)
|
71
|
+
# - target (or -)
|
72
|
+
# - gramm. function for roles (not to be used)
|
73
|
+
# - one column with role annotation
|
74
|
+
#
|
75
|
+
# All pieces are yielded as strings, except for the argument columns, which
|
76
|
+
# are yielded as an array of strings.
|
77
|
+
def each_line_parsed
|
78
|
+
lineno = 0
|
79
|
+
f = nil
|
80
|
+
@lines.each { |l|
|
81
|
+
f = TabFormatNamedArgs.new(l.split("\t"), @pattern, @group_no)
|
82
|
+
f.add_feature("lineno", lineno)
|
83
|
+
yield f
|
84
|
+
lineno += 1
|
85
|
+
}
|
86
|
+
end
|
87
|
+
|
88
|
+
###
|
89
|
+
# read_one_line:
|
90
|
+
# return a line of the sentence specified by its number
|
91
|
+
def read_one_line(number)
|
92
|
+
@lines[number]
|
93
|
+
end
|
94
|
+
|
95
|
+
###
|
96
|
+
# read_one_line_parsed:
|
97
|
+
# like get_line, but the features in the line are returned
|
98
|
+
# separately,
|
99
|
+
# as in each_line_parsed
|
100
|
+
def read_one_line_parsed(number)
|
101
|
+
if @lines[number].nil?
|
102
|
+
return nil
|
103
|
+
else
|
104
|
+
f = TabFormatNamedArgs.new(@lines[number].split("\t"), @pattern, @group_no)
|
105
|
+
f.add_feature("lineno", number)
|
106
|
+
return f
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
# set line no of first line of present sentence
|
111
|
+
def set_starting_line(n)
|
112
|
+
raise "Deprecated"
|
113
|
+
end
|
114
|
+
|
115
|
+
# returns line no of first line of present sentence
|
116
|
+
def get_starting_line
|
117
|
+
raise "Deprecated"
|
118
|
+
end
|
119
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
#################################################################
|
2
|
+
#################################################################
|
3
|
+
###
|
4
|
+
# value restriction (to pass on to a view):
|
5
|
+
# some column is restricted to be equal/inequal to some value
|
6
|
+
class ValueRestriction
|
7
|
+
|
8
|
+
attr_reader :val_is_variable, :table_name_included
|
9
|
+
|
10
|
+
###
|
11
|
+
# new(): store values
|
12
|
+
def initialize(column, # string: column name
|
13
|
+
value, # value this column is to be restricted to
|
14
|
+
var_hash = {}) # hash:additional settings. possible entries:
|
15
|
+
# posneg: string: "=" or "!=": equality or inequality restriction
|
16
|
+
# (default: =)
|
17
|
+
# table_name_included: boolean: is the table name aready included
|
18
|
+
# in the column name? default: false
|
19
|
+
|
20
|
+
@column = column
|
21
|
+
@value = value
|
22
|
+
|
23
|
+
@posneg = var_hash["posneg"]
|
24
|
+
if @posneg.nil?
|
25
|
+
# per default, equality restriction
|
26
|
+
@posneg = "="
|
27
|
+
else
|
28
|
+
unless ["=", "!="].include? @posneg
|
29
|
+
raise "posneg should be either '=' or '!='. I got: " + @posneg.to_s
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
@table_name_included = var_hash["table_name_included"]
|
34
|
+
if @table_name_included.nil?
|
35
|
+
# per default, the table name is not yet included
|
36
|
+
# in the column name
|
37
|
+
@table_name_included = false
|
38
|
+
end
|
39
|
+
|
40
|
+
# per default, value is a value and not another column name
|
41
|
+
@val_is_variable = false
|
42
|
+
end
|
43
|
+
|
44
|
+
###
|
45
|
+
# get(): returns a triple [column name(string), eq(string), value(object)]
|
46
|
+
def get
|
47
|
+
return [@column, @posneg, @value]
|
48
|
+
end
|
49
|
+
end
|
metadata
ADDED
@@ -0,0 +1,131 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: shalmaneser-lib
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.2.rc5
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Andrei Beliankou
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-01-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: pastel
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.5'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.5'
|
27
|
+
description: Common facilities for Shalmaneser and its modules.
|
28
|
+
email: arbox@yandex.ru
|
29
|
+
executables: []
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files:
|
32
|
+
- README.md
|
33
|
+
- LICENSE.md
|
34
|
+
- CHANGELOG.md
|
35
|
+
files:
|
36
|
+
- ".yardopts"
|
37
|
+
- CHANGELOG.md
|
38
|
+
- LICENSE.md
|
39
|
+
- README.md
|
40
|
+
- lib/configuration/config_data.rb
|
41
|
+
- lib/configuration/config_format_element.rb
|
42
|
+
- lib/configuration/configuration_error.rb
|
43
|
+
- lib/configuration/external_config_data.rb
|
44
|
+
- lib/configuration/frappe_config_data.rb
|
45
|
+
- lib/configuration/fred_config_data.rb
|
46
|
+
- lib/configuration/rosy_config_data.rb
|
47
|
+
- lib/db/db_interface.rb
|
48
|
+
- lib/db/db_mysql.rb
|
49
|
+
- lib/db/db_sqlite.rb
|
50
|
+
- lib/db/db_table.rb
|
51
|
+
- lib/db/db_view.rb
|
52
|
+
- lib/db/db_wrapper.rb
|
53
|
+
- lib/db/select_table_and_columns.rb
|
54
|
+
- lib/db/sql_query.rb
|
55
|
+
- lib/definitions.rb
|
56
|
+
- lib/eval.rb
|
57
|
+
- lib/ext/maxent/Classify.class
|
58
|
+
- lib/ext/maxent/Train.class
|
59
|
+
- lib/external_systems.rb
|
60
|
+
- lib/framenet_format/fn_corpus_aset.rb
|
61
|
+
- lib/framenet_format/fn_corpus_xml_file.rb
|
62
|
+
- lib/framenet_format/fn_corpus_xml_sentence.rb
|
63
|
+
- lib/framenet_format/fn_database.rb
|
64
|
+
- lib/framenet_format/frame_xml_file.rb
|
65
|
+
- lib/framenet_format/frame_xml_sentence.rb
|
66
|
+
- lib/logging.rb
|
67
|
+
- lib/ml/classifier.rb
|
68
|
+
- lib/ml/mallet.rb
|
69
|
+
- lib/ml/maxent.rb
|
70
|
+
- lib/ml/optimize.rb
|
71
|
+
- lib/ml/timbl.rb
|
72
|
+
- lib/monkey_patching/array.rb
|
73
|
+
- lib/monkey_patching/enumerable_bool.rb
|
74
|
+
- lib/monkey_patching/enumerable_distribute.rb
|
75
|
+
- lib/monkey_patching/file.rb
|
76
|
+
- lib/monkey_patching/subsumed.rb
|
77
|
+
- lib/ruby_class_extensions.rb
|
78
|
+
- lib/salsa_tiger_xml/corpus.rb
|
79
|
+
- lib/salsa_tiger_xml/fe_node.rb
|
80
|
+
- lib/salsa_tiger_xml/file_parts_parser.rb
|
81
|
+
- lib/salsa_tiger_xml/frame_node.rb
|
82
|
+
- lib/salsa_tiger_xml/graph_node.rb
|
83
|
+
- lib/salsa_tiger_xml/reg_xml.rb
|
84
|
+
- lib/salsa_tiger_xml/salsa_tiger_sentence.rb
|
85
|
+
- lib/salsa_tiger_xml/salsa_tiger_sentence_graph.rb
|
86
|
+
- lib/salsa_tiger_xml/salsa_tiger_sentence_sem.rb
|
87
|
+
- lib/salsa_tiger_xml/salsa_tiger_xml_helper.rb
|
88
|
+
- lib/salsa_tiger_xml/salsa_tiger_xml_node.rb
|
89
|
+
- lib/salsa_tiger_xml/sem_node.rb
|
90
|
+
- lib/salsa_tiger_xml/string_terminals_in_right_order.rb
|
91
|
+
- lib/salsa_tiger_xml/syn_node.rb
|
92
|
+
- lib/salsa_tiger_xml/tree_node.rb
|
93
|
+
- lib/salsa_tiger_xml/ts_syn_node.rb
|
94
|
+
- lib/salsa_tiger_xml/usp_node.rb
|
95
|
+
- lib/salsa_tiger_xml/xml_node.rb
|
96
|
+
- lib/shalmaneser/lib.rb
|
97
|
+
- lib/tabular_format/fn_tab_format_file.rb
|
98
|
+
- lib/tabular_format/fn_tab_frame.rb
|
99
|
+
- lib/tabular_format/fn_tab_sentence.rb
|
100
|
+
- lib/tabular_format/tab_format_file.rb
|
101
|
+
- lib/tabular_format/tab_format_named_args.rb
|
102
|
+
- lib/tabular_format/tab_format_sentence.rb
|
103
|
+
- lib/value_restriction.rb
|
104
|
+
homepage: https://github.com/arbox/shalmaneser
|
105
|
+
licenses:
|
106
|
+
- GPL-2.0
|
107
|
+
metadata: {}
|
108
|
+
post_install_message:
|
109
|
+
rdoc_options:
|
110
|
+
- "-m"
|
111
|
+
- README.md
|
112
|
+
require_paths:
|
113
|
+
- lib
|
114
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - '='
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '2.0'
|
119
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ">"
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: 1.3.1
|
124
|
+
requirements: []
|
125
|
+
rubyforge_project:
|
126
|
+
rubygems_version: 2.5.1
|
127
|
+
signing_key:
|
128
|
+
specification_version: 4
|
129
|
+
summary: Shalmaneser Library
|
130
|
+
test_files: []
|
131
|
+
has_rdoc:
|