Showing posts with label medical linguistics. Show all posts
Showing posts with label medical linguistics. Show all posts

Tuesday, March 4, 2008

Medical Linguistics, Part 5

The past few blogs have been a series devoted to Medical Linguistics. Yesterday's blog discussed the fundamental linguistic principles underlying the doublet method.

In today's blog, I'm posting a Perl script that extracts, from a large nomenclature, the terms that cannot be composed from doublets contained in other terms (i.e., the terms that must include unique doublets).

The key lines in the script are (that create the list of doublets) are shown here:

foreach $thing (@words)
{
$doublet = "$oldthing $thing";
if ($doublet =~ /^[a-z]+ [a-z]+$/)
{
$doublethash{$doublet} =
$doublethash{$doublet} + 1;
}
$oldthing = $thing;
}


These lines are used in virtually every Perl script that uses the doublet method. Basically, they move through an array consisting of the consecutive words in a nomenclature term, two words at a time, creating a new doublet and a new member of a doublet hash structure, with each loop. If you know Perl, this little piece of code should be easy to understand.

The entire Perl script follows here. As with all my posted scripts, the software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. in no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.

#!/usr/local/bin/perl
open(TEXT,"neocl.xml")||die"cannot";
open(OUT,">dubuniq.txt")||die"cannot";
$line = " ";
while ($line ne "")
{
$line = <TEXT>;
next if ($line !~ /\"(C[0-9]{7})\"/);
next if ($line !~ /\"\> ?(.+) ?\<\//);
$line =~ /\"\> ?(.+) ?\<\//;
$phrase = $1;
@words = split(/ /, $phrase);
foreach $thing (@words)
{
$doublet = "$oldthing $thing";
if ($doublet =~ /^[a-z]+ [a-z]+$/)
{
$doublethash{$doublet} =
$doublethash{$doublet} + 1;
}
$oldthing = $thing;
}
}
close TEXT;
open(TEXT,"neocl.xml")||die"cannot";
$phrase = "";
$line = " ";
$count = 0;
while ($line ne "")
{
$oldthing = "";
$rightflank = "";
$leftflank = "";
$line = <TEXT>;
next if ($line !~ /\"(C[0-9]{7})\"/);
next if ($line =~ /\"C0000000\"/);
next if ($line =~ /\"C0000001\"/);
next if ($line !~ /\"\> ?(.+) ?\<\//);
$line =~ /\"\> ?(.+) ?\<\//;
$phrase = $1;
@words = split(/ /, $phrase);
next if (scalar(@words) < 3);
foreach $thing (@words)
{
$newdoublet = "$oldthing $thing";
if ($newdoublet =~ /^[a-z]+ [a-z]+$/)
{
if (exists($doublethash{$newdoublet}))
{
if ($doublethash{$newdoublet} == 1)
{
if ($phrase =~ /[a-z]+ $oldthing/)
{
$leftflank = $&;
}
if ($phrase =~ /$thing [a-z]+/)
{
$rightflank = $&;
}
unless ($doublethash{$leftflank} > 1
&& $doublethash{$rightflank} > 1)
{
$uniqphrase{$phrase} = "";
}
}
}
}
$oldthing = $thing;
}
}

while ((my $key, my $value) = each(%uniqphrase))
{
$count++;
print OUT "$count $key\n";
}
exit;

The output consists of a file composed of a list of terms, one line per term, that cannot be constructed from doublets found in other terms. This output was discussed in a prior blog. A sample list of doublets is available for download.

- Jules Berman

My book, Principles of Big Data: Preparing, Sharing, and Analyzing Complex Information was published in 2013 by Morgan Kaufmann.



I urge you to read more about my book. Google books has prepared a generous preview of the book contents. If you like the book, please request your librarian to purchase a copy of this book for your library or reading room.

tags: big data, metadata, data preparation, data analytics, data repurposing, datamining, data mining, doublet method, medical linguistics, medical algorithm, nomenclature

Monday, March 3, 2008

Medical Linguistics, Part 4

In the past few blogs, . I have been covering some special linguistic aspects of medical terminologies.

Let's summarize:

1. In a large medical nomenclature, singlets (single-word terms) are infrequent. In our example terminology, the Neoplasm Classification, there are about 500 singlets in a classified nomenclature that contains more than 130,000 terms! By the way, the Neoplasm Classification is available for download as a gzipped XML file.

2. All multi-word terms are composed of doublets (two-word terms), and doublets have a more specific meaning than do singlets.

3. Most multi-word terms in medical nomenclatures are composed of doublets that are found in other terms from the same nomenclature. In the Neoplasm Classification (exceeding 130,000 different terms), there are fewer than 300 terms that cannot be composed of doublets found from other terms.

What do these empirical observations imply?

1. If you parse through any medical text, and you encounter a sequence of words composed of doublets [that are found in a nomenclature], the sequence of words is likely to contain terms from the nomenclature.

2. Conversely, if you parse through any medical text, and you encounter a sequence of words composed of doublets [that are NOT found in a nomenclature], the sequence of words is likely NOT to contain terms from the nomenclature.

3. If you parse through any medical text, and you encounter a sequence of words composed of doublets [that are found in a nomenclature], and the sequence of words does not contain terms from the nomenclature, then the sequence of words may contain one or more new terms that can be added to the nomenclature.

In the next blogs, we will explore how to use these ideas to design software software that can:

1. Automatically extract terms from a medical corpus (large text file)

2. Automatically code the extracted terms that match existing terms in the nomenclature

3. Automatically remove extraneous words from medical recrods that may contain patient identifiers or private information related to patients

4. Identify new candidate terms that may need to be added to the nomenclature

If you understand this blog, and if you have a little programming skill, you can write simple, fast, medical software that can perform many of the common computational tasks encountered by biomedical informaticians.

As per usual, most of the topics explored in this blog have been discussed in my book, Biomedical Informatics. Programming skills for biomedical professionals are taught in my books, Perl Programming for Medicine and Biology and Ruby Programming for Medicine and Biology.

- Jules Berman

My book, Principles of Big Data: Preparing, Sharing, and Analyzing Complex Information was published in 2013 by Morgan Kaufmann.



I urge you to read more about my book. Google books has prepared a generous preview of the book contents. If you like the book, please request your librarian to purchase a copy of this book for your library or reading room.

tags: big data, metadata, data preparation, data analytics, data repurposing, datamining, data mining, medical autocoding, medical data scrubbing, medical data scrubber, medical record scrubbing, medical record scrubber, medical text parsing, medical autocoder, nomenclature, terminology, biomedical informatics, doublet method, medical terminology, medical autocoding, medical autocoder, medical record de-identification, medical record deidentification, medical informaticist, biomedical informaticist, medical informatics, biomedical algorithms, medical algorithms

Sunday, March 2, 2008

Medical Linguistics, Part 3

In yesterday's blog, I wrote that medical terms are composed of doublets, each of which convey a very specific meaning. Individual words seldom have a single meaning.

Most terms in a medical nomenclature are composed of doublets found elsewhere in the terminology. In other words, unique terms are composed of common doublets, with very few exceptions.

The Neoplasm Classification contains over 130,000 names of neoplasms. Among these large numbers of terms, there are about 1,500 terms that contain a doublet that is uniquely found in the term (i.e., not found in one or more additional terms in the nomenclature). This represents about 1% of the total number of terms in the nomenclature. (The entire Neoplasms Classification is available as a gzipped file from my web site.

The Perl script that produces the list of terms that cannot be constructed from doublets found in other terms, is discussed in a later blog.

- Jules Berman

key words: doublet method, neoplasm classification, nomenclature,