triple_parser 0.1.11 → 0.1.12
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/main.rb +3 -3
- data/lib/triple_parser/triple_set.rb +4 -2
- metadata +1 -1
data/lib/main.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
require_relative 'triple_parser'
|
2
2
|
|
3
3
|
text = <<EOF
|
4
|
-
id:9108fe02-0bbb-4ed9-890f-b454877ce12c
|
5
|
-
id:9108fe02-0bbb-4ed9-890f-b454877ce12c
|
6
|
-
id:9108fe02-0bbb-4ed9-890f-b454877ce12c
|
4
|
+
id:9108fe02-0bbb-4ed9-890f-b454877ce12c rdf:type owl:event:Event
|
5
|
+
id:9108fe02-0bbb-4ed9-890f-b454877ce12c domain:name xml:string:'Troops tighten grip on Taliban stronghold'
|
6
|
+
id:9108fe02-0bbb-4ed9-890f-b454877ce12c owl:event:time id:0237eb08-e4a5-463c-baaa-5a28f2b63707
|
7
7
|
<http://www.undervale.co.uk/things/9108fe02-0bbb-4ed9-890f-b454877ce12c#id> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.org/NET/c4dm/event.owl#Event>.
|
8
8
|
EOF
|
9
9
|
|
@@ -75,12 +75,14 @@ module TripleParser
|
|
75
75
|
end
|
76
76
|
|
77
77
|
def triple_spitting_pattern
|
78
|
+
triple_containing_bracketed_data = %q{<[^>]*>}
|
78
79
|
triple_containing_single_quoted_text = %q{\S*\'.*\'\S*}
|
79
80
|
triple_containing_double_quoted_text = %q{\S*\".*\"\S*}
|
80
81
|
text_not_split_by_spaces = '\S*'
|
81
|
-
triple = [triple_containing_single_quoted_text, triple_containing_double_quoted_text, text_not_split_by_spaces].join('|')
|
82
|
+
triple = [triple_containing_bracketed_data, triple_containing_single_quoted_text, triple_containing_double_quoted_text, text_not_split_by_spaces].join('|')
|
82
83
|
spaced_triples = Array.new(3, "(#{triple})").join('\s+')
|
83
|
-
|
84
|
+
line_end = '[\s\.]*$'
|
85
|
+
Regexp.new(spaced_triples + line_end)
|
84
86
|
end
|
85
87
|
|
86
88
|
def spaces
|