how to extract the abbreviation from a given text uisng PERL

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • phoenie
    New Member
    • Mar 2008
    • 12

    how to extract the abbreviation from a given text uisng PERL

    Hi everyone,
    I am a newbie in Perl.
    I would like to know how to extract the abbreviation from a given text using Perl.

    For example,
    Dr. Alex is a very smart doctor. He is from USA.

    Then my output will be
    Dr.
    USA

    Thank you.
  • eWish
    Recognized Expert Contributor
    • Jul 2007
    • 973

    #2
    Are you looking to capture ALL abbreviations or just certain ones? If you just have a few then you could use a regular expression or ternary operator for this.

    Otherwise, I would suggest that you look at CPAN.

    --Kevin

    Comment

    • phoenie
      New Member
      • Mar 2008
      • 12

      #3
      Originally posted by eWish
      Are you looking to capture ALL abbreviations or just certain ones? If you just have a few then you could use a regular expression or ternary operator for this.

      Otherwise, I would suggest that you look at CPAN.

      --Kevin
      i want to get all abbreviations.. ..
      really thanx a lot...
      i will take a look on CPAN

      Comment

      • phoenie
        New Member
        • Mar 2008
        • 12

        #4
        Originally posted by eWish
        Are you looking to capture ALL abbreviations or just certain ones? If you just have a few then you could use a regular expression or ternary operator for this.

        Otherwise, I would suggest that you look at CPAN.

        --Kevin
        Hi,I am back.Really sorry. Even though i already took one day to look for CPAN.
        I still cant figure out the solution. Can you help me a bit more?

        Comment

        • eWish
          Recognized Expert Contributor
          • Jul 2007
          • 973

          #5
          What you are wanting to do is really an undertaking. Take this list of abbreviations for example. It would not be a simple task to build an efficient script to search your text file for a word that matched any of the ones on the list. In my opinion this is where a database would be your friend.

          On the other hand if you wanted to only look for a few say 30 or so then you could use a hash. Which would be much easier.

          Essentially, what you want to do is read the file and split on the whitespace and loop through each for and see if it matches any of the words of your abbreviations list. Have you written any code at this point?

          --Kevin

          Comment

          Working...