Skip to content

Commit

Permalink
Rename Name#s_str => sensu_stricto
Browse files Browse the repository at this point in the history
For clarity and to avoid ambiguity
  • Loading branch information
JoeCohen committed Feb 19, 2024
1 parent e4f257a commit fe349d3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
22 changes: 11 additions & 11 deletions app/helpers/object_link_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,18 @@ def ascomycete_org_name_url(name)
# omit `group`l their search ORs all of the words
# The site is Euro-centric, omitting many N Amer spp.
# so ORing the words gives more results
"https://ascomycete.org/Search-Results?search=#{name.s_str}"
"https://ascomycete.org/Search-Results?search=#{name.sensu_stricto}"
end

def gbif_name_search_url(name)
# omit `group`, else there are no hits
# omit quotes around the name in order to get synonyms and cf's
"https://www.gbif.org/species/search?q=#{name.s_str}"
"https://www.gbif.org/species/search?q=#{name.sensu_stricto}"
end

def inat_name_search_url(name)
# omit `group`, else there are no hits
"https://www.inaturalist.org/search?q=#{name.s_str}"
"https://www.inaturalist.org/search?q=#{name.sensu_stricto}"
end

# url for IF record
Expand All @@ -93,21 +93,21 @@ def index_fungorum_name_web_search_url(name)
# I want a backslash between "q=" and "site",
# but can't figure the rigth way to do this.
# I can construct a link_to this url
# https://duckduckgo.com/?q=\site%3Aindexfungorum.org+%22#Tricholoma equestre%22&ia=web
# If I copy the above and paste it into a browser address bar
# https://duckduckgo.com/?q=\site%3Aindexfungorum.org+%22Tuber+liui%22
# If I copy it and paste it into a browser address bar
# DuckDuckGo goes straight to the first search result
# It works the same if I right click on the displayed link,
# select Copy Link Address, and paste it into the address bar.
# BUT if I click on the link displayed in MO, it doesn't work.
"https://duckduckgo.com/?q=site%3Aindexfungorum.org+" \
"%22#{name.s_str}%22&ia=web"
"%22#{name.sensu_stricto}%22"
end

def mushroomexpert_name_web_search_url(name)
# Use DuckDuckGo see https://github.com/MushroomObserver/mushroom-observer/issues/1884#issuecomment-1950137454
# quote name sensu stricto to get right # of results.
"https://duckduckgo.com/?q=site%3Amushroomexpert.com+" \
"%22#{name.s_str}%22&ia=web"
"%22#{name.sensu_stricto}%22&ia=web"
end

# url for MB record by number
Expand All @@ -118,7 +118,7 @@ def mycobank_record_url(record_id)
# url for MycoBank name search for text_name
def mycobank_name_search_url(name)
"#{mycobank_basic_search_url}/field/Taxon%20name/#{
name.s_str.gsub(" ", "%20")
name.sensu_stricto.gsub(" ", "%20")
}"
end

Expand All @@ -136,13 +136,13 @@ def mycobank_host
# and all the hits will include group if hits exist
def mycoportal_url(name)
"http://mycoportal.org/portal/taxa/index.php?taxauthid=1&taxon=" \
"#{name.s_str}"
"#{name.sensu_stricto}"
end

# Use name s.s. because including group gets 0 or few hits;
# i.e., only sequenquenes whose notes or other field include "group"
def ncbi_nucleotide_term_search_url(name)
"https://www.ncbi.nlm.nih.gov/nuccore/?term=#{name.s_str}"
"https://www.ncbi.nlm.nih.gov/nuccore/?term=#{name.sensu_stricto}"
end

# url of SF page with "official" synonyms by category
Expand All @@ -160,7 +160,7 @@ def species_fungorum_sf_synonymy(record_id)
def wikipedia_term_search_url(name)
# Use name s.s. because including "group" gets hits that
# don't include name s.s.
"https://en.wikipedia.org/w/index.php?search=#{name.s_str}"
"https://en.wikipedia.org/w/index.php?search=#{name.sensu_stricto}"
end

# ----------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion app/models/name/format.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def real_search_name
Name.display_to_real_search(self)
end

def s_str
def sensu_stricto
# sub(/ #{Name::Parse::GROUP_ABBR}/, "")
text_name.sub(GROUP_ADD_ON_MATCHER, "")
end
Expand Down
4 changes: 2 additions & 2 deletions test/models/name_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2656,9 +2656,9 @@ def test_make_sure_names_are_bolded_correctly

def test_s_str
%w[group gr gr. gp gp. clade complex].each do |str|
assert_equal(Name.new(text_name: "Boletus #{str}").s_str, "Boletus",
assert_equal(Name.new(text_name: "Boletus #{str}").sensu_stricto, "Boletus",
"Name s.s. should not include `#{str}`")
assert_equal(Name.new(text_name: "Boletus#{str}").s_str, "Boletus#{str}",
assert_equal(Name.new(text_name: "Boletus#{str}").sensu_stricto, "Boletus#{str}",
"Name ss should include `#{str}` if it's part of the genus")
end
end
Expand Down

0 comments on commit fe349d3

Please sign in to comment.