INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

New to TCL programming need some help

New to TCL programming need some help

(OP)
I am learning TCL and have been given an assignment to test my knowledge. I am trying to create a simple spell checker, but am having a hard time getting all my parameters met. I think I can accomplish these requirements with regular expressions, but I am not sure how to go about it properly. Here is my problem:

Spell check rules:

1. The spell checker should be case insensitive. Meaning, if the word ‘APRIL’ is found in the input file and the word ‘April’ is defined in the dictionary file, then it should not regard this as a mistake.

2. Punctuation marks and symbols should be ignored. Words enclosed in quotes should still be checked.

3. Numbers should be ignored unless they are in ordinal form (e.g. 1st, 2nd, 3rd, etc). Commas in large numbers are valid (e.g. 29,300).

4. Words ending with a possessive apostrophe (’s) should be ignored and not considered mistakes.


Now I've worked out the problem for case 1. But like I said I believe I can work out the other requirements with regex(es) but Im not sure how to go about it. Any help would be greatly appreciated.

RE: New to TCL programming need some help

(OP)
And just let me say I am not a student. I have to learn this language for my job, but I'm not getting any help in learning other than here's the material go learn it. I'm a show me kinda learner that's all.

RE: New to TCL programming need some help

What form does your dictionary have (a list of valid words?)?

_________________
Bob Rashkin

RE: New to TCL programming need some help

(OP)
just a small dat file with a list of words.

RE: New to TCL programming need some help

OK. You say you have the case sensitivity issue resolved but let's review. The list (dictionary) should be all lower case. Then you use "string tolower ..." on each word being tested. Then on the words that fail, use regsub to remove everything but the letters. So let's say you have a word, test_word (that's a variable name). Then:

CODE -->

regsub -all ![a-zA-z] $test_word "" test_word 
then test it again.

_________________
Bob Rashkin

RE: New to TCL programming need some help

(OP)
Thanks so much!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close