VIVO-125 Create more "Google Spanish" labels
Add more labels by changing the filter in the label_stripper/label_inserter scripts. Improve the structure of the scripts to use an external filter.
This commit is contained in:
parent
b758f374ad
commit
c5acf46316
5 changed files with 589 additions and 423 deletions
|
@ -11,6 +11,9 @@ require 'rdf/ntriples'
|
|||
require 'rdf/n3'
|
||||
|
||||
include RDF
|
||||
|
||||
class UsageError < StandardError; end
|
||||
class FilterError < StandardError; end
|
||||
|
||||
class LabelCommon
|
||||
# ------------------------------------------------------------------------------------
|
||||
|
@ -21,6 +24,13 @@ class LabelCommon
|
|||
public
|
||||
# ------------------------------------------------------------------------------------
|
||||
|
||||
def self.load_filter(filter_file)
|
||||
return lambda{|s| true} unless filter_file
|
||||
return eval(IO.read(filter_file))
|
||||
rescue
|
||||
raise FilterError.new($!.message)
|
||||
end
|
||||
|
||||
def initialize(rdf_file, &filter)
|
||||
@filter = filter.nil? ? lambda{true} : filter
|
||||
@graph = Graph.load(rdf_file)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue