<?xml version='1.0' encoding="utf-8"?>
      <rss version='2.0'>
      <channel>
      <title>Форум на Исходниках.RU</title>
      <link>https://forum.sources.ru</link>
      <description>Форум на Исходниках.RU</description>
      <generator>Форум на Исходниках.RU</generator>
  	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=9143&amp;view=findpost&amp;p=89873</guid>
        <pubDate>Mon, 29 Sep 2003 06:00:31 +0000</pubDate>
        <title>Хэш для Спелчекера</title>
        <link>https://forum.sources.ru/index.php?showtopic=9143&amp;view=findpost&amp;p=89873</link>
        <description><![CDATA[wormball: <div class='tag-quote'><span class='tag-quote-prefix'>Цитата</span> <span class='tag-quote__quote-info'>DVA, 28.09.03, 11:20:44</span><div class='quote '>&amp; the British Province of the Society of Jesus</div></div><br>иезуиты?<br><br>наверное поетому они используют тип cardinal ;D]]></description>
        <author>wormball</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=9143&amp;view=findpost&amp;p=89872</guid>
        <pubDate>Sun, 28 Sep 2003 07:20:44 +0000</pubDate>
        <title>Хэш для Спелчекера</title>
        <link>https://forum.sources.ru/index.php?showtopic=9143&amp;view=findpost&amp;p=89872</link>
        <description><![CDATA[DVA: <div class='tag-quote'><span class='tag-quote-prefix'>Цитата</span> <span class='tag-quote__quote-info'>Mixxx, 27.09.03, 21:25:17</span><div class='quote '>В сети нашёл список русских слов и хочу попытаться сделать на его основе спелчекер :)<br>Слышал что для этой цели хорошо подходит хэш (Если просто тупа юзать бинарный поиск<br>то тратиться много памяти)<br>Подскажите как бы мне это лучше реализовать и какую хэш функцию применить.<br></div></div><br>Hash для спеллчекеров подходит плохо, потому как приходится искать &quot;похожие&quot; слова и части слова. Больше подходит Ternary Search Tree (TST).<br><br>По-поводу же hash-функции, - например, некоторых устраивает такая:<br><div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">&#60;br&#62;{ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Copyright (c) 2000 Robert R. Marsh, S.J. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}&#60;br&#62;{ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &amp; the British Province of the Society of Jesus &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}&#60;br&#62;&#60;br&#62;// Multiplication with overflow is used to randomize the bit pattern ...&#60;br&#62;// works four bytes at a time and then tidies up any hanging bytes.&#60;br&#62;&#60;br&#62;function Hash2(const Key; KeyLength: Integer): Cardinal;&#60;br&#62;const&#60;br&#62; &nbsp;Mask : array [1..3] of Cardinal = ({text}0000FF, {text}00FFFF, {text}FFFFFF);&#60;br&#62;type&#60;br&#62; &nbsp;TBuffer = array[0..0] of Cardinal;&#60;br&#62; &nbsp;PBuffer = ^TBuffer;&#60;br&#62;var&#60;br&#62; &nbsp;i: cardinal;&#60;br&#62; &nbsp;P: PBuffer;&#60;br&#62; &nbsp;h: Cardinal;&#60;br&#62; &nbsp;kd, km: cardinal;&#60;br&#62;begin&#60;br&#62; &nbsp;// start with a good &quot;random&quot; bit pattern so that&#60;br&#62; &nbsp;// even single byte hashes are well scattered over&#60;br&#62; &nbsp;// a 32-bit range&#60;br&#62; &nbsp;Result := E3779B9;&#60;br&#62; &nbsp;P := @Key;&#60;br&#62; &nbsp;i := 0;&#60;br&#62; &nbsp;kd := KeyLength shr 2; // div SizeOf(Integer);&#60;br&#62; &nbsp;while i &#60; kd do&#60;br&#62; &nbsp;begin&#60;br&#62; &nbsp; &nbsp;h := P[i];&#60;br&#62; &nbsp; &nbsp;Inc(i);&#60;br&#62; &nbsp; &nbsp;Inc(Result, (E3779B9 * h));&#60;br&#62; &nbsp;end;&#60;br&#62; &nbsp;km := KeyLength and 3; // mod SizeOf(Integer);&#60;br&#62; &nbsp;if km &#62; 0 then&#60;br&#62; &nbsp;begin&#60;br&#62; &nbsp; &nbsp;h := P[i] and mask[km];&#60;br&#62; &nbsp; &nbsp;Inc(Result, (E3779B9 * h));&#60;br&#62; &nbsp;end;&#60;br&#62; &nbsp;// i.e. rotate the Result bit-pattern to the right to keep&#60;br&#62; &nbsp;// early bits in the key from getting completely lost&#60;br&#62; &nbsp;Result := (Result shr 15) or (Result shl 17);&#60;br&#62;end;&#60;br&#62;</div></ol></div></div></div></div><script>preloadCodeButtons('1');</script><br>]]></description>
        <author>DVA</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=9143&amp;view=findpost&amp;p=89870</guid>
        <pubDate>Sat, 27 Sep 2003 17:25:17 +0000</pubDate>
        <title>Хэш для Спелчекера</title>
        <link>https://forum.sources.ru/index.php?showtopic=9143&amp;view=findpost&amp;p=89870</link>
        <description><![CDATA[Mixxx: В сети нашёл список русских<br>слов и хочу попытаться сделать на его<br>основе спелчекер :)<br>Слышал что для этой цели<br>хорошо подходит хэш<br>(Если просто тупа юзать бинарный поиск<br>то тратиться много памяти)<br>Подскажите как бы мне это <br>лучше реализовать<br>и какую хэш функцию применить.<br>]]></description>
        <author>Mixxx</author>
        <category>Алгоритмы</category>
      </item>
	
      </channel>
      </rss>
	