PDA

View Full Version : سوال: پیدا کردن کلمات شبیه به کلمه مورد نظر



delphi77
شنبه 12 اردیبهشت 1388, 14:07 عصر
من می خواهم بدانم اگر بخواهم یک کلمه را با کلمه دیگر مقایسه کنم چطور باید اینکار را بکنم

و از چه روشی میشه کلماتی شبیه به کلمه اصلی را از دیتابیس بیرون کشید را کرد

مثلا:
کلمه : دوستدار

باید برای من کلماتی مانند دوستی ، دوست داشتن، دوست، دار ، دارا، داد و ستد و ... را اگر در دیتابیسم بود بده

فکر می کنید از چه روشی باید استفاده کنم

ahmadbadpey
شنبه 12 اردیبهشت 1388, 15:24 عصر
کوئری ای که برای این کار میتونی بنویسی اینه :

$test="friends";
mysql_query("select * from table where `field1` like %$test%",$conn);

این کوئری رکورد هایی که تو فیلد field1 شون مشابه عبارت text رو پیدا کنه بر می گردونه

delphi77
شنبه 12 اردیبهشت 1388, 17:52 عصر
ممنون ولی این کوئری آنهایی که test توی آنها باشه میاره

ولی مثلا tset [برعکس] را نمی آره

یا مثلا ests را نمیاره

__ziXet__
شنبه 12 اردیبهشت 1388, 20:02 عصر
این دیگه هوش مصنوعی میشه! pspell رو یه تستی بکن!
تو LiveDic از pspell استفاده کردم!
البته برای english نه فارسی

delphi77
یک شنبه 13 اردیبهشت 1388, 18:34 عصر
pspell مثالی ازش نیست و اینکه باید روی آپاچی نصب بشه چطوری ؟

__ziXet__
یک شنبه 13 اردیبهشت 1388, 20:11 عصر
pspell مثالی ازش نیست و اینکه باید روی آپاچی نصب بشه چطوری ؟
بستگی داره بخوای رو لینوکس نصب کنی یا ویندوز!
برو به http://aspell.net
بعد ورژن مورد نظرت رو نصب کن و در آخر هم glossaryمخصوص رو نصب کن.
البته یه glossary فارسی هم نوشتن که خیلی کامل نیست ! من فارسیشو تست نکردم.
ولی کلا چیز خوبیه! سرعتش عالیه

hidensoft
یک شنبه 13 اردیبهشت 1388, 20:38 عصر
نیاز به آنچنان هوش مصنوعی هم نیست ،
به نظر شما خود pspellچطوری کلمات شبیه به هم رو پیدا می کنه ؟ مطمئنا پشت سر هم چیده نشدند که بشگی 5 بعد و 5 قبل رو پیدا می کنه درسته ؟
به نظر من پیاده سازیش زیاد سخت نیست .

ببینید خود کلمه test رو در نظر بگیرید ، در ابتدا با همون کد یه کوئری بزنید.


select * from table where `field1` like %test%
حالا بار دوم یک حرف رو از اول کلمه بردارید که بشه

select * from table where `field1` like %est%
حالا یک حرف رو از آخر بردارید

select * from table where `field1` like %es%

به نظر من اگه شما تمام کلمات رو لیست داشته باشید ، الان به نزدیک ترین نتایج به کلمه test به ترتیب اولویت در شباهت رسیدید.

فقط اینجا یه نکته هست که باید متذکر بشم ،
پیشنهاد می کنم یه فانکشن برای export کردن کارکتر هایی که می تونید جستجو کنید بنویسید و بعد تمام اونها رو یک جا وارد کنید مثلا :



select * from table where `field1` like %test% OR
`field1` LIKE %est% OR `field1` LIKE %es%


اینم هوش مصنوعی :لبخند:

__ziXet__
یک شنبه 13 اردیبهشت 1388, 20:59 عصر
نیاز به آنچنان هوش مصنوعی هم نیست ،
به نظر شما خود pspellچطوری کلمات شبیه به هم رو پیدا می کنه ؟ مطمئنا پشت سر هم چیده نشدند که بشگی 5 بعد و 5 قبل رو پیدا می کنه درسته ؟
به نظر من پیاده سازیش زیاد سخت نیست .

ببینید خود کلمه test رو در نظر بگیرید ، در ابتدا با همون کد یه کوئری بزنید.


select * from table where `field1` like %test%
حالا بار دوم یک حرف رو از اول کلمه بردارید که بشه

select * from table where `field1` like %est%
حالا یک حرف رو از آخر بردارید

select * from table where `field1` like %es%

به نظر من اگه شما تمام کلمات رو لیست داشته باشید ، الان به نزدیک ترین نتایج به کلمه test به ترتیب اولویت در شباهت رسیدید.

فقط اینجا یه نکته هست که باید متذکر بشم ،
پیشنهاد می کنم یه فانکشن برای export کردن کارکتر هایی که می تونید جستجو کنید بنویسید و بعد تمام اونها رو یک جا وارد کنید مثلا :



select * from table where `field1` like %test% OR
`field1` LIKE %est% OR `field1` LIKE %es%


اینم هوش مصنوعی :لبخند:
شما حالت خوبه؟!!
اونوقت با اینهمه query فکر میکنی یه suggest چقدر طول میکشه؟

hidensoft
یک شنبه 13 اردیبهشت 1388, 22:09 عصر
شما حالت خوبه؟!!
اونوقت با اینهمه query فکر میکنی یه suggest چقدر طول میکشه؟
من حالم خوبه و در دوران بسیار خوب مرخصی سربازی به سر می برم.

اما در خوب بودن حال شما شک دارم به 3 دلیل
1- با توجه به تاریخ عضویت و تعداد پست های ارسالی چنین پاسخ هایی از کاربران قدیمی و یا حداقل فعال بعیده.
2- یک کوئری بیشتر زده نمی شه ، پرسس می خواد چقدر طول بکشه ؟ بسته به خود شما داره ، که لقمه رو بگذاری دهنت و یا دور گردنت بچرخونی .
3- فکر می کنی ریزالت MySQL بیشتر از زمانی هست که شما یه Request بفرستی و Response برگرده و شما Response رو حلاجی کنی و جوابی که می خوای بدی بیرون ؟

4- به هیچ وجه وجود کوئری های زیاد دلیل optimize نبودن کد نیست ، من فکر می کنم در این زمینه شما دانش زیادی نداشته باشید و بهتره حداقل یه کتاب در این رابطه بخونید ، به عنوان مثال کتاب

High Performance MySQL: Optimization, Backups, Replication, and More (Paperback) (http://www.amazon.com/High-Performance-MySQL-Optimization-Replication/dp/0596101716/ref=sr_1_2?ie=UTF8&s=books&qid=1241373930&sr=1-2)


می تونه گذینه مناسبی باشه ،

__ziXet__
یک شنبه 13 اردیبهشت 1388, 22:35 عصر
من حالم خوبه و در دوران بسیار خوب مرخصی سربازی به سر می برم.

اما در خوب بودن حال شما شک دارم به 3 دلیل
1- با توجه به تاریخ عضویت و تعداد پست های ارسالی چنین پاسخ هایی از کاربران قدیمی و یا حداقل فعال بعیده.
2- یک کوئری بیشتر زده نمی شه ، پرسس می خواد چقدر طول بکشه ؟ بسته به خود شما داره ، که لقمه رو بگذاری دهنت و یا دور گردنت بچرخونی .
3- فکر می کنی ریزالت MySQL بیشتر از زمانی هست که شما یه Request بفرستی و Response برگرده و شما Response رو حلاجی کنی و جوابی که می خوای بدی بیرون ؟

4- به هیچ وجه وجود کوئری های زیاد دلیل optimize نبودن کد نیست ، من فکر می کنم در این زمینه شما دانش زیادی نداشته باشید و بهتره حداقل یه کتاب در این رابطه بخونید ، به عنوان مثال کتاب

High Performance MySQL: Optimization, Backups, Replication, and More (Paperback) (http://www.amazon.com/High-Performance-MySQL-Optimization-Replication/dp/0596101716/ref=sr_1_2?ie=UTF8&s=books&qid=1241373930&sr=1-2)

می تونه گذینه مناسبی باشه ،
یه جکی نوشتی بعد داری ازش دفاع میکنی؟ اگه اینجوری بود پس این همه برنامه نویس علاف بودن که رو پروژه aspell کار کنن؟!!
عزیزم خودت برو یه کتاب بخون! نمیخواد به من چیزی معرفی کنی
امضامو ببین تا بفهمی کی اینکارس
(هدف من از اول کل کل نبود ولی خود شما شروع کردی)

__ziXet__
یک شنبه 13 اردیبهشت 1388, 22:43 عصر
در ضمن شما برو اینوببین: http://livedic.ir/#word:distingus
ببین چه کلمه هایی پیشنهاد میکنه!
شما ببین میتونی چیزی بنویسی که اینو در بیاری؟!

delphi77
دوشنبه 14 اردیبهشت 1388, 11:12 صبح
__ziXet__ راست میگه اگر من مثلا بخواهم test کلماتی مانند t?e?s?t را بده چه کوئری باید زد یا برعکس test را بخواهم یعنی tset یا کلماتی که با حروف آن ساخته شدن مثلا toster حالا چی؟

به هر حال دعوا که نداره اصلا نخواستیم اگر قرار باشه سوالی مطرح بشه و مشکل برای کسی بوجود بیاد من راضی نیستم

delphi77
دوشنبه 14 اردیبهشت 1388, 13:13 عصر
من رفتم توی سایتی که گفتید و این را دانلود کردم

0.61-20071105 (ftp://alpha.gnu.org/gnu/aspell/aspell-0.61-20071105.tar.gz)

ولی واقعا نمی دانم چطور باید نصب شه

__ziXet__
دوشنبه 14 اردیبهشت 1388, 13:25 عصر
من رفتم توی سایتی که گفتید و این را دانلود کردم

0.61-20071105 (ftp://alpha.gnu.org/gnu/aspell/aspell-0.61-20071105.tar.gz)

ولی واقعا نمی دانم چطور باید نصب شه
سلام

شما نگفتی رو ویندوز میخوای نصب کنی یا لینوکس؟
اینی که دانلود کردی واسه لینوکسه!
شما اگه تو ویندوز میخوای کار کنی از http://aspell.net/win32/ برو خود برنامه که یه فایل exe هست رو دانلود کن و بعد یه گلاسری هم از پاین انتخاب کن و هردوشون رو نصب کن.
اگه این کارا رو کردی بیا بقیه شو بت بگم

موفق باشید

golbafan
دوشنبه 14 اردیبهشت 1388, 19:51 عصر
چرا دعوا میکنید
بهتره همفکری کنید
نظر من اینه که از فیلتر like استفاده کنید
در ضمن با هوش مصنوعی هم میشه این کار رو کرد ولی نیازمند یک database بزرگ و یک الگوریتم یادگیری مناسبه که فکر نمیکنم برای این کار مقرون به صرفه باشه

__ziXet__
دوشنبه 14 اردیبهشت 1388, 22:30 عصر
خوب من
1- Full installer را دانلود و نصب کردم
2- aspell-en-0.50-2-3.exe هم دانلود و نصب کردم

اولی را در فولدری به نام aspell و دومی را در aspell/en

حالا دستور بعدی چیه؟
خب بقیه اش رو هم از اینجا برو:
http://www.bitweaver.org/wiki/Install+pspell+on+Windows

:d

delphi77
دوشنبه 14 اردیبهشت 1388, 23:27 عصر
خوب من
1- Full installer را دانلود و نصب کردم
2- aspell-en-0.50-2-3.exe هم دانلود و نصب کردم

اولی را در فولدری به نام aspell و دومی را در aspell/en

حالا دستور بعدی چیه؟


خب بقیه اش رو هم از اینجا برو:
http://www.bitweaver.org/wiki/Install+pspell+on+Windows

دستت درد نکنه
سال الگوی مصرفه و صرفه جویی می کنیا می خوای کاغذ زیادی مصرف نکنی می دانم [منظورم حافظه بود]

hidensoft
سه شنبه 15 اردیبهشت 1388, 13:18 عصر
اصلا مسئله دعوا نیست ،
من می گم این برنامه خودش چطوری یه جستجوی خوب انجام میده ؟

حالا شما دوست دارید می تونید از یک برنامه خارجی خروجی بگیرید ، اما این تنها راه نیست.
text processing اون قدر مبحث بزرگی نیست.
موفق باشید.

delphi77
سه شنبه 15 اردیبهشت 1388, 13:32 عصر
نمی دانم چرا این error را می ده

http://barnamenevis.org/forum/attachment.php?attachmentid=30534&stc=1&d=1241515916

hidensoft
سه شنبه 15 اردیبهشت 1388, 14:42 عصر
<?php

/**
* Simple PHP MySQL Spell checker class.
* MySQL SQL to make the word table:
* CREATE TABLE `words` (
* `WORD` char(50) NOT NULL default '',
* PRIMARY KEY (`WORD`)
* ) TYPE=MyISAM;
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @author Sam Clarke <admin@free-php.org.uk>
* @version 1.0
* @package MySQL PHP spell checker
* @example example.php
* @copyright Copyright (C) 2005, Sam Clarke.
*/

/*
+----------------------------------------------+
| |
| PHP MySQL Spell checker class |
| |
+----------------------------------------------+
| Filename : spell-checker-class.php |
| Created : 22-Sep-05 15:54 GMT |
| Created By : Sam Clarke |
| Email : admin@free-php.org.uk |
| Version : 1.0 |
| |
+----------------------------------------------+
*/

class spell_checker
{
/**
* @access private
*/
var $mysql_link;

/**
* MySQL database password
* @access private
* @var string
*/
var $pass;

/**
* MySQL database username
* @access private
* @var string
*/
var $user;

/**
* MySQL host name
* @access private
* @var string
*/
var $host = 'localhost';

/**
* MySQL database name
* @access private
* @var string
*/
var $db;

/**
* MySQL table name
* @access private
* @var string
*/
var $table = 'words';

/**
* Stores the array of words to check
* @access private
*/
var $words = array();

/**
* Place in the array of words
* @access private
*/
var $place = 0;

/**
* Stores words to ignore
* @access private
*/
var $ignore = array();



/**
* connects to the db and selects the db
*
* Opens a connection with MySQL and selects the database.
* You must call set_mysql_info() first!
*
* @return bool returns true if can open a connection and sellect the db or it returns false
*/
function db_connect()
{
$this->mysql_link = mysql_connect($this->host, $this->user, $this->pass) or die(mysql_error()); // connect to MySQL
if (!$this->mysql_link) // if the connection is false
{
return false; // return false
}

if (mysql_select_db($this->db, $this->mysql_link) or die(mysql_error())) // if the connection is OK select the db
{
return true; // if it select the db OK return true
}
return false; // other wise return false
}


/**
* Closes the link to MySQL
*
* Closes the link to MySQL that was opened by db_connect()
*/
function close_db()
{
mysql_close($this->mysql_link);
}


/**
* matches all the words and puts them in the word array
*
* Matches all the words in the string it is passed
* and puts them in the word array ready for checking.
*
* @param string $str // the string to get the words from
* @return bool returns true if it can match some words or it returns false
*/
function get_words_from_str($str)
{
$pattern = "/[a-zA-Z']+/i"; // pattern to make only word chars
if (preg_match_all($pattern, $str, $word)) // match them
{
for($i=0;isset($word[0][$i]);$i++)
{
$this->words[$i] = $word[0][$i]; // store them in the word array
}
return true;
}
return false;
}


/**
* Checks if a word is in the dictionary table
*
* Checks if a word is in the MySQL dictionary table.
*
* @param string $word the word to check
* @return bool returns true if it can match some words or it returns false
*/
function check_word($word)
{
$word = strtolower($word); // make the word lower case
// make sure theres no nasty stuff in the word
$word = mysql_real_escape_string($word, $this->mysql_link);
$sql = 'SELECT `WORD` FROM `' . $this->table . '` WHERE `WORD` = \'' . $word . '\' LIMIT 1';
$check = mysql_query($sql, $this->mysql_link); // check the word

if (!$check) // if there was an error return true
{
return false;
}

// if 1 rows came back then that word does not exist in the db so return true
if (mysql_num_rows($check) === 1)
{
return true;
}
return false; // other wise return false
}


/**
* Gets the next wrong word
*
* Gets the next wrong word from the array of words made
* by get_words_from_str().
*
* @return mixed returns the wrong word or returns false if there are no more words to check
*/
// gets the next wrong word
function get_next_wrong_word()
{
for (;isset($this->words[$this->place]);) // while there are still words
{
if (!$this->check_word($this->words[$this->place])) // check it
{
if (in_array($this->words[$this->place], $this->ignore)) // check it in the ignore list
{
$this->place++; // if it's in the ignore array goto next word
}
else
{
$this->place++; // add 1 to place so we don't check it again
return $this->words[$this->place-1]; // return the wrong word
}
}
$this->place++; // if it's right goto next word
}
return false; // there are no words left so return false
}


/**
* Resets the place for get_next_wrong_word()
*
* Resets the place for get_next_wrong_word() so it starts
* at the begining.
*
* @return void
*/
function reset_get_next_wrong_word()
{
$this->place=0;
}


/**
* Sets the MySQL infomation
*
* Sets the MySQL infomation used in this spellcheck class.
*
* @param string $user The username to use for MySQL
* @param string $pass The password to use for MySQL
* @param string $db The db name to use for MySQL
* @param string $table The MySQL table name with the spellcheck words in.
* @param string $host The MySQL hostname to use
* @return void
*/
function set_mysql_info($user, $pass, $db, $table='words', $host='localhost')
{
$this->pass = $pass;
$this->user = $user;
$this->host = $host;
$this->db = $db;
$this->table = $table;
}


/**
* Gets all the worng words and puts them in an array.
*
* Gets all the worng words from the array of words made
* by get_words_from_str() and returns them in an array.
*
* @return void
*/
function get_all_wrong_words()
{
$wrong_words = array();
$place = 0;
for (;isset($this->words[$place]);) // while there are still words
{
if (!$this->check_word($this->words[$place])) // check it
{
if (in_array($this->words[$place], $this->ignore)) // check it in the ignore list
{
$place++; // if it's in the ignore array goto next word
}
$this->place++; // add 1 to place so we don't check it again
$wrong_words[] = $this->words[$place]; // return the wrong word
}
$place++; // if it's right goto next word
}
return $wrong_words; // there are no words left so return the array
}


/**
* Replaces all the words in str.
*
* Replaces all the words in str from the array of words made
* by get_words_from_str() that this function calls. It
* will add what ever you put as $rf at the front of of all the
* wrong words and add what ever you put as $re to the end of
* them so you could make $rf = '<span style="color:#FF0000">'
* and $re = '</span>' so that people can see the spelling mistakes.
*
* @param string $str the string you want the wrong words replaced in
* @param string $rf what you want to put infront of the wrong words
* @param string $re what you want to put at the end of the wrong words
* @return string returns the string with the wring wirds replaced
*/
function replace_all($str, $rf = '<span style="color:#FF0000">', $re = '</span>')
{
if (!$this->get_words_from_str($str)) // make sure could get the words
{
return $str; // return the string
}
$wrongwords = $this->get_all_wrong_words(); // get the wrong words

for($i=0;isset($wrongwords[$i]);$i++)
{
$str = preg_replace("/\b".$wrongwords[$i]."\b/si", $rf.$wrongwords[$i].$re, $str);
}
return $str; // return the string
}


/**
* Adds a word to the ignore array.
*
* @param string $word the word to ignore
* @return void
*/
function add_word_to_ignore($word)
{
$this->ignore[] = $word; // add the word to the ignore array
}


/**
* Finds any words with the same soundex as the word and returns them
* in an array.
*
* Finds any words with the same soundex as the word and returns them
* in an array it takes a secound param the limits how many results are
* returned.
*
* @param string $word word to find words with the same soundex of
* @return mixed returns flase if there was an error searching or returns an array
* of words that have the same soundex of $word
*/
function suggest($word, $max=20)
{
$suggestions = array(); // make an array to store the suggestions in
$word = strtolower($word); // make the word lower case
// make sure theres no nasty stuff in the word
$word = mysql_real_escape_string($word, $this->mysql_link);
$sql = 'SELECT `WORD` FROM `' . $this->table . '` WHERE SOUNDEX(`WORD`)';
$sql .= ' = SOUNDEX(\'' . $word . '\') LIMIT ' . $max . '';
$results = mysql_query($sql, $this->mysql_link); // run the sql
if (!$results) // if there was an error runing the sql return false
{
return false;
}
for(;$row = mysql_fetch_array($results, MYSQL_ASSOC);) // while there are still words
{
$suggestions[] = $row['WORD']; // add the word to the suggestion array
}
return $suggestions; // return the suggestion
}
}
?>


Example


include 'spell-checker-class.php'; // include the spell checker class


$spell_checker = new spell_checker; // Creat an instance of spell checker class
// set the info to use when doing things with MySQL
$spell_checker->set_mysql_info ('username', 'password', 'database_name');
$spell_checker->db_connect(); // connect to MySQL


if ($spell_checker->check_word('test')) // find out if test is in the dic
{
echo 'Test is in the dic'."\n";
}
else
{
echo 'You need a better dic'."\n";
}


$str = 'this is a string with a tiepoo.'."\n";
// get all the words from the string and store them in an array in the class
$spell_checker->get_words_from_str($str);
for(;$wrong = $spell_checker->get_next_wrong_word();)
{
echo 'This word from the var str is wrong:' . $wrong . "\n";
}

echo $spell_checker->replace_all($str); // replace all the wrong words in $str

echo 'the words in the array below have a soundex like the word test'."\n";
print_r($spell_checker->suggest('test'));

$spell_checker->close_db(); // close db link

__ziXet__
سه شنبه 15 اردیبهشت 1388, 23:24 عصر
استفاده از soundex هم برای کارهای ساده خوبه ولی اصلا به پای aspell نمیرسه!
میتونید امتخان کنید.

موفق باشید

delphi77
چهارشنبه 16 اردیبهشت 1388, 13:31 عصر
دوتا مشکل

اول اینکه aspell ظاهرا دیکشنریش توی dll است و من می خواهم با دیکشنری خودم جایگزین کنم

دوم روی سیستم من با مشخصات زیر


ApacheFriends XAMPP (Basispaket) version 1.7.0 ######

+ Apache 2.2.11
+ MySQL 5.1.30 (Community Server)
+ PHP 5.2.8 + PEAR (Support for PHP 4 has been discontinued)
+ PHP-Switch win32 1.0 (use "php-switch.bat" in the xampp main directory)
+ XAMPP Control Version 2.5 from www.nat32.com
+ XAMPP Security 1.0
+ SQLite 2.8.15
+ OpenSSL 0.9.8i
+ phpMyAdmin 3.1.1
+ ADOdb 4.990
+ Mercury Mail Transport System v4.52
+ FileZilla FTP Server 0.9.29
+ Webalizer 2.01-10
+ Zend Optimizer 3.3.0
+ eAccelerator 0.9.5.3 für PHP 5.2.8 (but not activated in the php.ini)

error زیر را می دهد
http://barnamenevis.org/forum/attachment.php?attachmentid=30534&stc=1&d=1241515916

1- من هر دو فایل نصبی را در فولدر D:\xampp\Aspell نصب کردم
2- aspell-15.dll را توی system32 کپی کردم
3- توی فولدر D:\xampp\htdocs هم مثال خودش را گذاشم که متاسفانه error می ده

__ziXet__
چهارشنبه 16 اردیبهشت 1388, 14:18 عصر
دوتا مشکل

اول اینکه aspell ظاهرا دیکشنریش توی dll است و من می خواهم با دیکشنری خودم جایگزین کنم

دوم روی سیستم من با مشخصات زیر


ApacheFriends XAMPP (Basispaket) version 1.7.0 ######

+ Apache 2.2.11
+ MySQL 5.1.30 (Community Server)
+ PHP 5.2.8 + PEAR (Support for PHP 4 has been discontinued)
+ PHP-Switch win32 1.0 (use "php-switch.bat" in the xampp main directory)
+ XAMPP Control Version 2.5 from www.nat32.com
+ XAMPP Security 1.0
+ SQLite 2.8.15
+ OpenSSL 0.9.8i
+ phpMyAdmin 3.1.1
+ ADOdb 4.990
+ Mercury Mail Transport System v4.52
+ FileZilla FTP Server 0.9.29
+ Webalizer 2.01-10
+ Zend Optimizer 3.3.0
+ eAccelerator 0.9.5.3 für PHP 5.2.8 (but not activated in the php.ini)

error زیر را می دهد
http://barnamenevis.org/forum/attachment.php?attachmentid=30534&stc=1&d=1241515916

1- من هر دو فایل نصبی را در فولدر D:\xampp\Aspell نصب کردم
2- aspell-15.dll را توی system32 کپی کردم
3- توی فولدر D:\xampp\htdocs هم مثال خودش را گذاشم که متاسفانه error می ده
یه phpinfo بگیر ببین توش pspell درست نصب شده یا نه؟
فعلا راهی برای جایگزینی دیکشنری براش پیدا نکردم!
بگو چیکار میخوای بکنی تا بهت بگم.

موفق باشی

delphi77
چهارشنبه 16 اردیبهشت 1388, 17:28 عصر
http://barnamenevis.org/forum/attachment.php?attachmentid=30584&stc=1&d=1241616292

خوب نصب شده ولی .....

ببینید من یک جدول دارم که توش تعدادی لغته

که می خواهم وقتی یک کلمه خاص را می زنم از توی آن جدول به من مشابه های آن را بده

table words
test
toster
text
taxi
tet
txt
tset

__ziXet__
چهارشنبه 16 اردیبهشت 1388, 19:57 عصر
http://barnamenevis.org/forum/attachment.php?attachmentid=30584&stc=1&d=1241616292

خوب نصب شده ولی .....

ببینید من یک جدول دارم که توش تعدادی لغته

که می خواهم وقتی یک کلمه خاص را می زنم از توی آن جدول به من مشابه های آن را بده

table words
test
toster
text
taxi
tet
txt
tset
اون ارور رو هنوز میده؟ وقتی از pspell استفاده میکنی میده؟
راستش برای اینکه دیتابیس خودت رو با اون تطابق بدی تنها راهش چک کردن این هست که اون کلمه در دیتابیست هست یا نه؟
آرایه بازگشتی رو بذار تو حلقه و یکی یکی چک کن

موفق باشید

delphi77
پنج شنبه 17 اردیبهشت 1388, 09:50 صبح
من توی php یک تابع پیدا کردم به نام similar_text فکر می کنید چقدر مفید باشه

نقطه ضعفش چیه ؟

__ziXet__
پنج شنبه 17 اردیبهشت 1388, 09:54 صبح
چه ربطی به این داره؟
similiar_text دوتا رشته رو میگیره بعد میگه چند درصد شبیه هم هستن! http://ir.php.net/similar_text
قابلیت suggest نداره

شما باید بگی واسه suggest کردن میخوای یا فقط میخوای از نظر املایی متن رو چک کنی

delphi77
پنج شنبه 17 اردیبهشت 1388, 10:09 صبح
خوب مثلا اگر من کلمه ام را با تمام کلمات در دیتابیسم با فانکش similiar_text مقایسه کنم و آنهایی که فرضا 40 درصد شبیه به کلمه من هستند را پیدا کنم خودش یک suggest میشه دیگه

__ziXet__
پنج شنبه 17 اردیبهشت 1388, 10:38 صبح
خوب مثلا اگر من کلمه ام را با تمام کلمات در دیتابیسم با فانکش similiar_text مقایسه کنم و آنهایی که فرضا 40 درصد شبیه به کلمه من هستند را پیدا کنم خودش یک suggest میشه دیگه
اوه! میدونی این چقدر طول میکشه؟ یعنی اگع دیتابیست 100000 کلمه هم داشته باشه حلقه 1000000 بار اجرا میشه و هربار مقایسه انجام میشه!
به نظر من منطقی نیست