Using Synonyms
The function synonym() is used to search for synonyms of a given word or phrase. The words and phrases are considered to be synonyms if they belong to the same entry of a Synonyms dictionary.
The synonym() function allows the search of semantic or contextual synonyms in a concise way as it is often more convenient to add synonyms to the dictionary than to list them all in a query.
The Synonyms dictionary entry is a set of synonyms assigned to a head word marked with the capital H in the dictionary manager, as seen in the picture below. The head word gives the name to the entry.
There are two Synonyms dictionaries available in PA - Default and Abbreviations. The first contains general vocabulary, while the second focuses on name abbreviations. It is also possible to create a custom dictionary and add any elements that users would like to be considered synonyms. For example, if users are interested in drug packaging, they can create their own Synonyms dictionary and add different types of drug containers to the entry "container", as shown in the picture below. This means that the query synonym(container) returns the mentions of all the words from this entry, e.g. "blister" or "bottle".
Enabling dictionaries
In order to search for dictionary entries, users should make sure that the required dictionary is enabled in the node properties. In order to do that, users should right-click on the node, open its Properties and go to the Dictionaries tab. A list of available dictionary categories is in the left part of the window. Once the Synonyms category is chosen, a list of available dictionaries appears in the right part of the window. Both default and custom dictionaries can be used. In order to enable a dictionary, users can select it using the check box, press the "OK" button to save the changes, and then execute the node.
Syntax
Arguments
The function requires a term which can be any word or phrase present in a dictionary of the Synonyms category. The function takes any number of terms as a comma-separated list. The term does not have to be a head word of the synonym set - for example, in the picture above the query synonym(container)=synonym(bottle)=synonym(blister) etc.
In order to narrow the search, it is possible to set an optional argument part of speech (POS-tag). In such case the function only returns those matches that have the indicated POS-tag.
Please find the list of valid part of speech values in the table below.
Part of speech value |
Short Notation |
Example |
noun |
event, sister’s, cats … |
|
verb |
talked, admit, moving, goes … |
|
adverb |
advb |
suddenly, more, yet, now … |
adjective |
adjc |
big, important, hard-working … |
Examples
The examples illustrate the work of the synonym() function with the help of the following dictionary entries:
synonym(iddm, niddm) returns the mentions of "IDDM", "NIDDM" and their synonyms, e.g. "type I diabetes" and "type II diabetes".
synonym(verb, brew) returns the mentions of "brew" and its synonyms if they are verbs e.g. "brewed by the Tokyo-based company", but NOT "a brewage of fraud and deception".
Task Example: Disease Incidence Analysis
There are often multiple ways of writing the name of the same disorder. In order to find the cases where people complained about a particular problem, users can create an entry with all its synonyms and search for them in the relevant context. For instance, users can create an entry "COPD" with synonyms and forms of chronic obstructive pulmonary disease, as in the picture below.
Then the following query can be formed:
follow(1, findings|impression|diagnosis|complaints, synonym(copd))
The query returns the words "findings", "impression", "diagnosis" or "complaints" followed by one of the COPD synonyms at any distance in the span of one sentence.
Task Example: Sentiment Analysis
For a simple sentiment analysis task users can create Synonyms dictionary entries with evaluative adjectives and search for them in the relevant context. For example, if you are interested in positive feedback on the service quality you can list synonyms of the word "good" as in the picture below.
Then the following query can be formed:
phrase(0, synonym(good), service)
The query returns all the texts where the word "service" follows the words "amazing", "excellent", "good", "great", "nice" or "wonderful".