Skip to content

Commit

Permalink
Improve the guard clause in math parsing
Browse files Browse the repository at this point in the history
This simple test for '<' character, which is always present in
MathML and HTML mathematical formulas, improves performance of
ConceptsCollection::build_from_dataset two-fold.
  • Loading branch information
skalee committed Mar 15, 2021
1 parent f0dc56e commit 4b2c0a9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/iev/termbase/term_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ def html_entities_to_stem(x)
end

def mathml_to_asciimath(input)
return input if input.nil? || input.empty?
return input if input.nil? || input.empty? || !input.include?("<")

unless input.match?(/<math>/)
return html_to_asciimath(input)
Expand Down

0 comments on commit 4b2c0a9

Please sign in to comment.