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. vscode设置代码块

    需要注意一点是,内容主体里面带有缩进的地方不能用 Tab,只能用空格

  2. 【python游戏编程04--加载位图与常用的数学函数】

    一.pygame中常用的数学函数 首先介绍两个角度和弧度转换的函数 math.degress()和math.radians()用法很简单,只要将数值传进去然后接受返回值就可以 math.cos(ang ...

  3. eclipse中如何打开工作空间里面已经有的项目

    File->Import->打开大类General->找到小类Existing Projects info Workspace->选择Select root dirctory, ...

  4. iOS开发 -------- transform属性(形变)

      一 transform属性 在OC中,通过transform属性可以修改对象的平移,比例和旋转角度 常用的创建transform结构体的方法分两大类 (1) 创建"基于控件初始位置&qu ...

  5. 一道简单树形dp

    题意:给定一棵树,从中选出一些节点,使得不成父子关系的节点对数最多.问这个最大值是多少. 思路:首先既然是给定一颗树,先要选择合适的数据结构,来保存这颗树.由于这颗树只关心根节点在哪里,所以只需要用一 ...

  6. Java基础学习-HelloWorld案例的编写和运行

    一.HelloWorld案例的流程:         第一步:编写一个.java的源文件.通过Windows自带的记事本文件就可以完成.         第二步:将.java的源文件通过编译器编译生成 ...

  7. Intellij IDEA的下载安装与破解

    一,下载与安装 1.官网下载:https://www.jetbrains.com/idea/ 2.选择Windows对应版本安装 二,破解 1.下载破解补丁:http://idea.lanyus.co ...

  8. 论文笔记:Structure Inference Net: Object Detection Using Scene-Level Context and Instance-Level Relationships

    Structure Inference Net: Object Detection Using Scene-Level Context and Instance-Level Relationships ...

  9. Centos7 安装并配置redis

    一. 安装 操作系统:Centos 7. 最小化安装 redis版本: 4.0.2 服务器地址:*** 安装过程: 安装wget, yum -y install wget 2.  下载redis wg ...

  10. pandas 对象中 to_pickle 方法参数命名问题,不能用frame

    这句话一直报错,经过反复排查,是命名问题,to_pickle() 参数不能是 frame,换一个名字就可以了 frame.to_pickle('examples\local_frame_pickle' ...