segments_lexicon 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/segments_lexicon.rb +15 -3
- data/lib/segments_lexicon/version.rb +2 -2
- metadata +1 -2
- data/lib/segments_lexicon/lexicon.rb +0 -19
data/lib/segments_lexicon.rb
CHANGED
@@ -1,6 +1,18 @@
|
|
1
|
+
require 'sqlite3'
|
1
2
|
require "segments_lexicon/version"
|
2
|
-
require "segments_lexicon/lexicon"
|
3
3
|
|
4
|
-
|
5
|
-
#
|
4
|
+
class SegmentsLexicon
|
5
|
+
# Opens a connection to the db
|
6
|
+
#
|
7
|
+
# param sqlite_db_path [String] Path to the sqlite3 db file
|
8
|
+
def initialize(sqlite_db_path, table_name)
|
9
|
+
@db = SQLite3::Database.new(sqlite_db_path)
|
10
|
+
@db.results_as_hash = true
|
11
|
+
@table = table_name
|
12
|
+
self
|
13
|
+
end
|
14
|
+
|
15
|
+
def search(query_term)
|
16
|
+
results = @db.execute "select * from #{@table} WHERE word LIKE \"#{query_term.downcase}\" COLLATE NOCASE"
|
17
|
+
end
|
6
18
|
end
|
@@ -1,3 +1,3 @@
|
|
1
|
-
|
2
|
-
VERSION = "0.0.
|
1
|
+
class SegmentsLexicon
|
2
|
+
VERSION = "0.0.2"
|
3
3
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: segments_lexicon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -40,7 +40,6 @@ files:
|
|
40
40
|
- README.md
|
41
41
|
- Rakefile
|
42
42
|
- lib/segments_lexicon.rb
|
43
|
-
- lib/segments_lexicon/lexicon.rb
|
44
43
|
- lib/segments_lexicon/version.rb
|
45
44
|
- segments_lexicon.gemspec
|
46
45
|
homepage: ''
|
@@ -1,19 +0,0 @@
|
|
1
|
-
require 'sqlite3'
|
2
|
-
|
3
|
-
class Lexicon
|
4
|
-
|
5
|
-
# Opens a connection to the db
|
6
|
-
#
|
7
|
-
# param sqlite_db_path [String] Path to the sqlite3 db file
|
8
|
-
def initialize(sqlite_db_path, table_name)
|
9
|
-
@db = SQLite3::Database.new(sqlite_db_path)
|
10
|
-
@db.results_as_hash = true
|
11
|
-
@table = table_name
|
12
|
-
self
|
13
|
-
end
|
14
|
-
|
15
|
-
def search(query_term)
|
16
|
-
results = @db.execute "select * from #{@table} WHERE word LIKE \"#{query_term.downcase}\" COLLATE NOCASE"
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|