<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'A Spell Checker - help needed' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'A Spell Checker - help needed' posted on the 'Delphi and Kylix' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2009 Programmers Heaven</copyright>
    <pubDate>Fri, 20 Nov 2009 20:30:45 -0700</pubDate>
    <lastBuildDate>Fri, 20 Nov 2009 20:30:45 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>A Spell Checker - help needed</title>
      <link>http://www.programmersheaven.com/mb/delphikylix/371470/371470/a-spell-checker---help-needed/</link>
      <description>Hello,&lt;br /&gt;
&lt;br /&gt;
I am making a spell checker and a beginner in Delphi.&lt;br /&gt;
&lt;br /&gt;
Well, I have 2 forms - Form1 has a MemoBox, and 3 buttons (Open File, Check File and Save File). When I click on Open file, the selected file is loaded in MemoBox and when I click on check file. It should start checking for spelling checks. and saving a file..shud save the file. In my Form 2, I have 2 edit boxes for 'Not in dictionary' and 'replace with' and 2 buttons 'Ignore' and 'Change'.&lt;br /&gt;
&lt;br /&gt;
Now I am stuck with 'Check file' code in Form 1. As soon as click on this button, the cursor should go to MemoBox. and it should start checking word by word from my 'list_of_words.text'. In case it found or not , Form 2 shoudl show up.&lt;br /&gt;
&lt;br /&gt;
I am not able to write code for this.&lt;br /&gt;
I have just written this and dont know how to proceed. Pls suggest.&lt;br /&gt;
&lt;br /&gt;
procedure TForm1.BitBtn3Click(Sender: TObject);&lt;br /&gt;
var&lt;br /&gt;
Txt:string;&lt;br /&gt;
StartPos, TxtLen, FoundPos:integer;&lt;br /&gt;
begin&lt;br /&gt;
  try&lt;br /&gt;
    While not EOF(MemoBox.text) do&lt;br /&gt;
    begin&lt;br /&gt;
    StartPos:=MemoBox.SelStart+MemoBox.SelLength&lt;br /&gt;
&lt;br /&gt;
//I think it will go char by char and as soon as it will find a space '', it will treat it as a word and then look up in the 'list_of_words.text' file.&lt;br /&gt;
&lt;br /&gt;
Regards&lt;br /&gt;
Pooja&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/delphikylix/371470/371470/a-spell-checker---help-needed/</guid>
      <pubDate>Thu, 24 Apr 2008 23:36:14 -0700</pubDate>
      <category>Delphi and Kylix</category>
    </item>
    <item>
      <title>Re: A Spell Checker - help needed</title>
      <link>http://www.programmersheaven.com/mb/delphikylix/371470/371486/re-a-spell-checker---help-needed/#371486</link>
      <description>: Hello,&lt;br /&gt;
: &lt;br /&gt;
: I am making a spell checker and a beginner in Delphi.&lt;br /&gt;
: &lt;br /&gt;
: Well, I have 2 forms - Form1 has a MemoBox, and 3 buttons (Open &lt;br /&gt;
: File, Check File and Save File). When I click on Open file, the &lt;br /&gt;
: selected file is loaded in MemoBox and when I click on check file. &lt;br /&gt;
: It should start checking for spelling checks. and saving a &lt;br /&gt;
: file..shud save the file. In my Form 2, I have 2 edit boxes for 'Not &lt;br /&gt;
: in dictionary' and 'replace with' and 2 buttons 'Ignore' and &lt;br /&gt;
: 'Change'.&lt;br /&gt;
: &lt;br /&gt;
: Now I am stuck with 'Check file' code in Form 1. As soon as click on &lt;br /&gt;
: this button, the cursor should go to MemoBox. and it should start &lt;br /&gt;
: checking word by word from my 'list_of_words.text'. In case it found &lt;br /&gt;
: or not , Form 2 shoudl show up.&lt;br /&gt;
: &lt;br /&gt;
: I am not able to write code for this.&lt;br /&gt;
: I have just written this and dont know how to proceed. Pls suggest.&lt;br /&gt;
: &lt;br /&gt;
: procedure TForm1.BitBtn3Click(Sender: TObject);&lt;br /&gt;
: var&lt;br /&gt;
: Txt:string;&lt;br /&gt;
: StartPos, TxtLen, FoundPos:integer;&lt;br /&gt;
: begin&lt;br /&gt;
:   try&lt;br /&gt;
:     While not EOF(MemoBox.text) do&lt;br /&gt;
:     begin&lt;br /&gt;
:     StartPos:=MemoBox.SelStart+MemoBox.SelLength&lt;br /&gt;
: &lt;br /&gt;
: //I think it will go char by char and as soon as it will find a &lt;br /&gt;
: space '', it will treat it as a word and then look up in the &lt;br /&gt;
: 'list_of_words.text' file.&lt;br /&gt;
: &lt;br /&gt;
: Regards&lt;br /&gt;
: Pooja&lt;br /&gt;
: &lt;br /&gt;
: &lt;br /&gt;
EOF (End-Of-File) cannot be used in this fashion, since MemoBox.Text isn't a file.&lt;br /&gt;
I would use a different way of grabbing the words: stripping the text itself:&lt;br /&gt;
1) Copy the text into a string variable&lt;br /&gt;
2) Remove any punctuation/double spaces/tabs from the text, so that you only have words and spaces&lt;br /&gt;
3) Grab the first word, and remove it from the text&lt;br /&gt;
&lt;pre class="sourcecode"&gt;
  WordToCheck := Copy(TheText, 1, Pos(' ', TheText)-1);
  Delete(TheText, 1, Pos(' ', TheText));
[/cdoe]
4) Check the word against your dictionary.
4a) If you want to replace the word, use the StringReplace() function on the original text.
4b) If you want to add the word to the dictionary or ignore the word, do nothing with the original text
Repeat steps 3 and 4 until all words are checked.

There are other (and better) ways of performing this kind of function, but this is quite easy to create.&lt;/pre&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/delphikylix/371470/371486/re-a-spell-checker---help-needed/#371486</guid>
      <pubDate>Fri, 25 Apr 2008 10:36:16 -0700</pubDate>
      <category>Delphi and Kylix</category>
    </item>
  </channel>
</rss>