Problem description

Given a text file, show the spell errors from it.  (https://www.andrew.cmu.edu/course/15-200/s06/applications/labs/lab3/)

Psuedo Code

The Dictionary Hash Table  (Error Detection)

      Read thru a file which contains all right words, with Key = each word, value = each word.

You have been provided with a dictionary that contains root words. These should be inserted into the dictionary hash table based on the hashCode() of their String representation.

The Misspellings Hash Table (Remediation)

You should create a new class of Objects to represent misspelled words. It should contain the misspelling and the correct spelling and should be able to report each. It should also override the hashCode() method to return the hashCode() of the misspelling. This will enable the retrieve() method of your hash table to find this object and the correct spelling within it, given the misspelling.

Finding Root Words using the following sequence

The provided dictionary only contains root words, not each of their forms. So, in order to find a word, you might need to reduce it to its root form. So, for each word, you should try at least the following:

  • The word exactly as it appears in the user-provided text
  • If the word ends in -ing, remove the -ing - 进行时, remove ing
  • If the word ends in -ing, remove the -ing and add -e - 进行时,remove ing再加e
  • If the word ends in -s, remove the -s  --加s的复数
  • If the word ends in -es, -ly, or -ed, remove the -es, -ly, or -ed - 加es的复数, 加ed的形容词, 加ly的副词, 后缀全都拿掉
  • If the word ends in -ies, remove the -ies, and add -y   - ies结尾的复数, 删掉加个y
  • If the word ends in -es or -ed, remove the --s or --d - es, ed结尾的复数和形容词, 只去掉s和d

foreach (var word in Text)
{
if (word in good words hash table)
{
continue;
}
else
{
can convert to the root words?
if yes, map hashtable, fail, report error
if no after going thru all rules, report error
}
}

Spell checker using hash table的更多相关文章

  1. 散列表(hash table)——算法导论(13)

    1. 引言 许多应用都需要动态集合结构,它至少需要支持Insert,search和delete字典操作.散列表(hash table)是实现字典操作的一种有效的数据结构. 2. 直接寻址表 在介绍散列 ...

  2. 哈希表(Hash Table)

    参考: Hash table - Wiki Hash table_百度百科 从头到尾彻底解析Hash表算法 谈谈 Hash Table 我们身边的哈希,最常见的就是perl和python里面的字典了, ...

  3. Berkeley DB的数据存储结构——哈希表(Hash Table)、B树(BTree)、队列(Queue)、记录号(Recno)

    Berkeley DB的数据存储结构 BDB支持四种数据存储结构及相应算法,官方称为访问方法(Access Method),分别是哈希表(Hash Table).B树(BTree).队列(Queue) ...

  4. 几种常见 容器 比较和分析 hashmap, map, vector, list ...hash table

    list支持快速的插入和删除,但是查找费时; vector支持快速的查找,但是插入费时. map查找的时间复杂度是对数的,这几乎是最快的,hash也是对数的.  如果我自己写,我也会用二叉检索树,它在 ...

  5. PHP内核探索之变量(3)- hash table

    在PHP中,除了zval, 另一个比较重要的数据结构非hash table莫属,例如我们最常见的数组,在底层便是hash table.除了数组,在线程安全(TSRM).GC.资源管理.Global变量 ...

  6. php Hash Table(四) Hash Table添加和更新元素

    HashTable添加和更新的函数: 有4个主要的函数用于插入和更新HashTable的数据: int zend_hash_add(HashTable *ht, char *arKey, uint n ...

  7. php Hash Table(一) Hash Table的结构

    关于Hash Table专题: 一直想深入理解一下php的hash table的实现,以前一直是星星点点的看看,从未彻底的总结过,那就从这个专题开始吧! 主要想总结几个部分:hashtable结构,h ...

  8. Spell checker

     Spell checker Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Subm ...

  9. Hash Table 的实现步骤是什么

    什么是HashTable Hash Table 是计算机科学中很重要的一种数据结构,其时间复杂度为O(1),主要是通过把关键字Key 映射到数组中的一个位置来访问记录,所以速度相当快.映射函数称为 H ...

随机推荐

  1. 剑指offer(30)连续子数组和的最大值

    题目描述 HZ偶尔会拿些专业问题来忽悠那些非计算机专业的同学.今天测试组开完会后,他又发话了:在古老的一维模式识别中,常常需要计算连续子向量的最大和,当向量全为正数的时候,问题很好解决.但是,如果向量 ...

  2. 【Python62--scrapy爬虫框架】

    一.Scrapy Scrapy是一个为了爬取网站数据,提取结构性数据而编写的应用框架,可以应用在包括数据挖掘,信息处理或存储历史数据等一系列的程序中 Scrapy最初是为页面抓取而设计的,也可以应用在 ...

  3. JavaScript自定义求和函数

    我爱撸码,撸码使我感到快乐!大家好,我是Counter,当看到这个标题到时候是不是感觉很简单,千万不要大意哦,你说0.1 + 0.2 = 0.3 ?有时候计算机并不是我们所说绝对精确,这个时候就要我们 ...

  4. AndroBench手机性能测试【转】

    本文转载自:https://www.cnblogs.com/jiangzhishan/archive/2018/07/16/9316279.html AndroBench是一个基准测试应用程序,可以衡 ...

  5. Convolutional Pose Machines

    Convolutional Pose Machines 2018-12-10 18:17:20 Paper:https://www.cv-foundation.org/openaccess/conte ...

  6. jQuery validator plugin 之 custom methods 案例1:multi email

    1.add method jQuery.validator.addMethod( "multiemail", function (value, element) { var ema ...

  7. Ubuntu 14.04 下安装 OpenCV

    参考: Installation in Linux Error compiling OpenCV, fatal error: stdlib.h: No such file or directory 图 ...

  8. Unity3D外包(u3d外包)—就找北京动点软件(我们长年承接U3D外包、Maya、3DMax项目外包)

    一.关于动点: 北京动点飞扬软件,因致力于虚拟现实技术的开发而创立,在虚拟现实开发领域有着卓越的技术和领先的思想.   我们为用户专业定制的项目,细分了多种工作流程,软件独立自主研发,编程简化用户操作 ...

  9. pinpoint与zipkin的比较

    经过本周部署和测试pinpoint监控平台的工作,我对这套开源系统有了更进一步的认识. 初次见到pinpoint这套系统时,我被它各方面优秀的特征所折服:无需对项目代码进行任何改动就可以部署探针.追踪 ...

  10. dropna(thresh=n) 的用法

    thresh=n,保留至少有 n 个非 NA 数的行