Documentation ¶
Index ¶
- Variables
- func GetCategories(tns []string) set.Set
- func GetTopCode(tn string) string
- func GetTopCodes(tns []string) set.Set
- func HasAnimalCode(tns []string) bool
- func HasClinicalCategory(tns []string) bool
- func Load(xmlFname string, customFnames ...string) *taxonomy.Taxonomy
- func Trim(tns []string) []string
- type Concept
- type ConceptName
- type Concepts
- type Descriptor
- type DescriptorName
- type Descriptors
- type Term
- type Terms
- type TreeNumbers
Constants ¶
This section is empty.
Variables ¶
var AnimalCodes = map[string]string{
"C22": "Animal Diseases",
}
AnimalCodes list codes for animal categories
var Categories = map[string]string{
"A": "Anatomy",
"B": "Organisms",
"C": "Diseases",
"D": "Chemicals and Drugs",
"E": "Analytical, Diagnostic and Therapeutic Techniques and Equipment",
"F": "Psychiatry and Psychology",
"G": "Biological Sciences",
"H": "Physical Sciences",
"I": "Anthropology, Education, Sociology and Social Phenomena",
"J": "Technology and Food and Beverages",
"K": "Humanities",
"L": "Information Science",
"M": "Persons",
"N": "Health Care",
"V": "Publication Characteristics",
"Z": "Geographic Locations",
}
Categories lists the top-level categories in the MeSH descriptor hierarchy.
var ClinicalCategories = map[string]string{
"A": "Anatomy",
"B": "Organisms",
"C": "Diseases",
"D": "Chemicals and Drugs",
"E": "Analytical, Diagnostic and Therapeutic Techniques and Equipment",
"F": "Psychiatry and Psychology",
"G": "Biological Sciences",
"M": "Persons",
"V": "Publication Characteristics",
}
ClinicalCategories lists the top-level clinical categories in the MeSH descriptor hierarchy.
var Normalize taxonomy.Normalizer = func(str string) (string, string) { s := strings.ToLower(str) s = reEG.ReplaceAllString(s, "") s = reE.ReplaceAllString(s, "") s = strings.Replace(s, ",", " ", -1) s = strings.Replace(s, "b hbsag", "hbv surface antigen", -1) s = strings.Replace(s, "hbsag hbv", "hbv surface antigen", -1) s = strings.Replace(s, "her2", "her-2", -1) s = reCNS.ReplaceAllString(s, "central nervous system") s = reAML.ReplaceAllString(s, "acute myeloid leukemia") s = reNSCLC.ReplaceAllString(s, "non-small cell lung cancer") s = reCLL.ReplaceAllString(s, "chronic lymphocytic leukemia") s = reHCC.ReplaceAllString(s, "hepatocellular carcinoma") s = reMM.ReplaceAllString(s, "multiple myeloma") s = reGI.ReplaceAllString(s, "gastrointestinal") s = reMRI.ReplaceAllString(s, "magnetic resonance imaging") if strings.Contains(s, "diabetes") { s = re1.ReplaceAllString(s, "1") s = re2.ReplaceAllString(s, "2") } if strings.Contains(s, "hepatitis") { s = strings.Replace(s, "b hbv", "b", -1) s = strings.Replace(s, "c hcv", "c", -1) s = strings.Replace(s, "active ", "", -1) s = strings.Replace(s, " treatment", "", -1) } else { s = reHBV.ReplaceAllString(s, "b hepatitis") s = reHCV.ReplaceAllString(s, "c hepatitis") s = strings.Replace(s, "b c hep", "b c hepatitis", -1) } if len(s) == 0 { s = str } s = strings.Trim(s, " /.,;:-") normalizedTerm := text.NormalizeWhitespace(s) normalizedMatch := reParenthesis.ReplaceAllString(normalizedTerm, " ") normalizedMatch = rePunct.ReplaceAllString(normalizedMatch, " ") normalizedMatch = strings.TrimSpace(normalizedMatch) l := strings.Fields(normalizedMatch) l = filter(l, generalWords) if v := strings.Join(l, " "); len(v) > 0 { normalizedTerm = v } l = filter(l, labelWords) sort.Strings(l) l = slice.Dedupe(l) normalizedMatch = strings.Join(l, " ") if len(normalizedMatch) == 0 { normalizedMatch = normalizedTerm } return normalizedMatch, normalizedTerm }
Normalize defines a normalizer function for MeSH terms. normalizedTerm replaces the extracted NER term. normalizedMatch is used to match terms to concepts.
Functions ¶
func GetCategories ¶
GetCategories gets the categories from tree numbers.
func GetTopCode ¶
GetTopCode gets the top code from a tree number.
func GetTopCodes ¶
GetTopCodes gets the top codes from tree numbers.
func HasAnimalCode ¶
HasAnimalCode returns true if any of the top codes are for animals.
func HasClinicalCategory ¶
HasClinicalCategory returns true if any of the categories are clinical.
Types ¶
type Concept ¶
type Concept struct { XMLName xml.Name `xml:"Concept"` Name ConceptName `xml:"ConceptName"` Terms Terms `xml:"TermList"` }
Concept defines the xml struct for Concept.
type ConceptName ¶
ConceptName defines the xml struct for ConceptName.
type Descriptor ¶
type Descriptor struct { XMLName xml.Name `xml:"DescriptorRecord"` Name DescriptorName `xml:"DescriptorName"` Concepts Concepts `xml:"ConceptList"` TreeNumbers TreeNumbers `xml:"TreeNumberList"` }
Descriptor defines the xml struct for Descriptor.
type DescriptorName ¶
DescriptorName defines the xml struct for DescriptorName.
type Descriptors ¶
type Descriptors struct { XMLName xml.Name `xml:"DescriptorRecordSet"` Descriptors []Descriptor `xml:"DescriptorRecord"` }
Descriptors defines the xml struct for Descriptors.
type Term ¶
type Term struct { XMLName xml.Name `xml:"Term"` Preferred string `xml:"ConceptPreferredTermYN,attr"` Name string `xml:"String"` ID string `xml:"TermUI"` }
Term defines the xml struct for Term.
func (Term) IsPreferred ¶
IsPreferred indicates whether the term is a preferred term for a concept.
type TreeNumbers ¶
type TreeNumbers struct { XMLName xml.Name `xml:"TreeNumberList"` TreeNumbers []string `xml:"TreeNumber"` }
TreeNumbers defines the xml struct for TreeNumbers.