首页 > > 详细

C++辅导自动纠错程序、辅导讲解C++Dynamic Programming辅导C/C++设计

word,,,。
 

Overview

For this project, you will develop an algorithm to identify the most likely sequence of typos a text underwent in the process of being typed. Designing and implementing this solution will require you to model the problem using dynamic programming, then understand and implement your model.
You are only allowed to consult the class slides, the textbook, the TAs, and the professor. In particular, you are not allowed to use the Internet. This is a group project. The only people you can work with on this project are your group members. This policy is strictly enforced. You may wish to review section 8.2 in the text, which describes a related problem.
In addition to the group submission, you will also evaluate your teammates’ cooperation and contribution. These evaluations will form a major part of your grade on this project, so be sure that you respond to messages promptly, communicate effectively, and contribute substantially to your group’s solution. Details for your team evaluations are in Section 5.2. You will submit the peer evaluations to another assignment on Canvas, labelled “Project 2 (individual).”
A word of warning: this project is team-based, but it is quite extensive and a nontrivial task. You are highly encouraged to start working on (and start asking questions about) this project early; teams who wait to start until the week before the due date may find themselves unable to complete it in time.

Problem Description

Your algorithm will accept a target string and a typo string, and it will compute the minimum cost for transforming the target string into the typo string, as well as a sequence of typos with this cost. The algorithm should recognize 4 different kinds of typos: insertions (adding extra characters), deletions (leaving out characters), substitutions (typing one character in place of another), and transpositions (swapping the order of two characters that appear next to one another).

Typo cost

Computing the cost for a particular typo, though, is a complex process, depending on the typo involved and where the keys for the related characters are located on the keyboard. The rules for computing the typo cost are summarized in the table below:

Typo Condition Cost
Inserting Repeated character 1
  Space after key on bottom row 2
  Space after something else 6
  Character before a space 6
  Before or after another key on same hand d(k1, k2)
  Before or after a key on opposite hand 5
Deleting Repeated character 1
  Space 3
  Character after another key on same hand 2
  Character after space or key on different hand 6
  First character in string 6
Substituting Space for anything or anything for space 6
  Key for another on same hand d(k1, k2)
  Key for another on same finger, other hand 1
  Key for another on different finger, other hand 5
Transposing Space with anything else 3
  Keys on different hands 1
  Keys on the same hand 2

Note that rules in the table above that reference a “hand” do not apply to spaces, which have separate rules. For ambiguous cases, you should report the minimum cost. This is especially notable when inserting a character between two others. For example, if you inserted a ‘m’ between an ‘a’ and an ‘m’, the cost would be 1 (for the repeated character), not 5 (for inserting after a character on the opposite hand).
The cost for two of the cases in this chart are given as d(k1 , k2 ), which represents the keyboard distance between these two keys. When computing keyboard distance, we assume that the typist is using a standard QWERTY keyboard where the keys can be arranged in 4 rows and 10 columns:

1234567890
qwertyuiop
asdfghjkl;
zxcvbnm,.

(You may assume that the strings will consist only of these characters and space.) The distance between a key in row r1 and column c1 and a key in row r2 and column c2 can be computed as:

d(k1, k2) = max{|r2 - r1 |, |c2 - c1|}

When minimizing this cost function, we can assume that typos are generated in left-to-right order (i.e., the order in which the typist is typing). This rule exists to prevent the algorithm from generating dubious typos like substituting one character for another on the same finger of the other hand, inserting or deleting the next character, then undoing the substitution. It also has the happy side effect of making this problem an excellent candidate for dynamic programming. You should consider transpositions to affect the first character being transposed, deletions to affect the position of the deleted character, and insertions and substitutions to affect the location of the new character.
An example for how to score various typos in a string is given.

Project report

㹮ഠ੹⁵⁲†㱰㹴ഠੲ⁥⁰⁲⁴‬†⁹㱯㹳൨੯⁵⁤†⁩⁣⁵⁤⁥†㱢㹥䥦㰠⽴㸱രਠⁱ⁵⁥⁳⁴⁩⁳‮‼ 㱰㸊䤼†䌠䠠䄼‾⁵⍣㱮⼠㹥ൡ੫†⁤⁷†⁡†㱬⽡㹥ഠੰ⁲⁢⁥†⁩㱮㹡൮੣⁥†⁩⁴†⁥†㱲㹯䑲㱥⽲㹮൳ੴ⁡⁣⁥⁳‿†⁙⁵⁲†㱡㹷䑥⁵⍤㱩⽮㹵൤੥†⁨⁷†⁴⁨⁥㰠⽳㹵൴੩†⁴†⁴⁨㱥㹲൩੧⁩⁡†⁰⁲⁢⁥㰠㸠㱦⽲㸠൴੨⁥†⁳⁵⁢⁰⁲⁢⁥㱳㸯䌾䡗䅨†⍬㰠⽴㸠൰੡⁲⁡⁥⁴⁥⁲⁳㰠⽢㹦൯ੲ†⁹⁵⁲†⁲⁥㱣㹳൩੶⁥†⁦⁵⁣⁴⁩‿‼㰯㸾㱴⼠㹣൵ੲ⁲⁥⁣⁥†⁣⁡†⁹㱵㹳⍴⵩⌠⭰ㅲ㱢⽬㸠൵ੳ⁩⁧†⁤⁹⁡㱭⽩㹰൲੯⁧⁲⁡㱭⽩㹬൩ਾ㰍⼊㹬൩ਾ㱗㹡䥴⁡⁨ⱥ†䍡䡳䅥⁵ †⁨†ⱴ⁵⍥⁷⁳⁥⁡†⡥⁳⁤〠⁤⁲†⁴⁣⁤†⥵Ⱳ⁥⁳⁴⁥⁴†‾⁶⁳⁣⁦⁡⁩⡺⹤⹤ⱹ♡㭲†㙡⵬㝧♯㬠⥴⹯†⁥†⁢⁰⁤⁥⁵⁥⁴⁨⁥⁩⡢⹥⹴ⱹ⁰ ‾†⁩⁨⁥☠㭣䥯⁩⁹㍵♲㭩⁺⁡♬㭨䥭‾ ⁩㐾♇㬠⥳⹥㱴⁦⼠㹮൥ੳ䉴⁤⁳⁴⁵†⁲⁥⁩⁲†⹩⁳䘠ⱬ⁩ †⁃†⁡⁥⁴⁨⁩♴㭶☠㭩⁴†⁶㍥⁤⁴♥㭤♡㭴⁨⁵⁦⁵ⰼ ‍⁲⁴⁴⁡㑮⹴㱡⽧㸠ൡ੮㱤㍤⁩㵤≶䕡≯㹦䔠㱥⽲㍴㹩൶੥㰠㹯㱲㸬㩮⁤⁴⁩†⁩†⁥൥ੴ㩯⁶⁥⁲‮‼⁨•⁹⁲൳ਢ‾⁃⁤⁩⁧†べㅯ㉵㍲㐠㕳㙯㝬㡵㥴どㅯ㉮㍳㐼㔯㙨㜲㠾㤍《ㄼ㉰㌾㑉㕮㘠㝡㡤㥤どㅴ㉩㍯㑮㔠㙴㝯㠠㥴とㅥ㈠㍲㑥㕰൯ੲ㱴⼬㸠㱳⽨㹤ഠ੩㱭㹬䍥†㩥㱤⼠㹹൮੡㱭㹰㱲㹭㉭㝩൮੧ㄠ⵴㉨ൡੴ䤠⁤⁨㑥ഠ੭⁹㘠⵴㝹൰੯䥳⁨†⁳㡴൲੩䥮⁵†⁡ㅹ〠ൢ੥䐠‫ㄠ㍯൲ਠ†ㅩ㑴ⴠㅭ㕵൳ੴ⁡ㅮ㕤ⴠㅲ㙵൮ਠ†⁲㉯㑮൭੥†⁲⁵㉳㙩൮੧⁰⁩㉮㝧ഠ੹⁡†㉢㡥ഠ੡䥣⁩⁨⁴㍨づഠ੣‍‼⁥㌾㐼ൣ੯†㍴㥹⵰㑯〠പਮ⁤㑥㐾ⴼ㐯㕰൲੥㠾഍ਊㄼばാ੹㉯㑵ഠੳ㱨⽯㹩㱮⽣㹥ഠ੡㰠㹡⁩⁡⁥ㄠ㑯ⵦㄠ㙣⁥⁡† ⁉†ⱳ⁥†⁴†⸠㱩⽮㹊ൡ੶㱡㌠⁹㴠≳ⵢⵡⵥ≪㹡⁩㰠⽥㍴㹨൥ੲ㰠㹡†⁣⁥⁢⁰⁩††⁳  †⁤⁩⁴⁥⁥⁩†⁲⁧⁩⁴⸰†⁲⁳ †‭†⁡ ⁰⁥⁳⁰⁨⁴Ⱜ†⁴⁡⁔††⁡⁩⁴ⱥ⁲⁳⁩⁧⁨⁲⁴⁣†Ⱐ⁴⁩⁸⁲ⱥ⁳⹡⁴⡥†⁡††⁳†⁰⸠⥩⁳⁥⁳†⁢⁩⁴⁤⁥ⱴ⁨⁲⁙⁴††⁰⁴⁳⁳⁣†⹧⁩†⁴⁡⁣⁰⁤⁡†⁳⁥⹴㰠⽮㹩൴੨㱥㸠⁧††⁣⁷⁲†⁲⁲⁳⁴㭦⁵⁩†⁥⁡††⁡⹮㱧⽩㹧ഠੴ㱨㈠⁣㵴∠≯㹲㱮⽰㉴㸮ഠਨ㱙㹵⁵⁴†⁨⁴⁴Ⱞ
†⁡†⁡⁢⁦⹳㰠⽷㹴൨ਠ㱥㍡⁣㵹∠䝲⵳≵㹭䝮㱴⽨㌠㹮൵੭㱢㹲†⁳⁴⁥†⁤⁣†⁳ㅥ⤠⁴⁵⁳⡨⁥⁲†㍡⤠⁳⁣‮䐯䙰‾ⰽ•⁰㉵⥴•⁰⁨⠳⁲⁲⁨㑯⥵⹬⁤䤠⁲⁩⁵⁴⁩⁵⁰‮⁣⁰†⁲†⁵⁵†⁩⁵䵭⽡⁦⁨⹥⁴⁲⁴⁴⁳⁥†⁡☠㭮⁹㉰⡳⤠♴㭯⁳⁰†䍦⹬㱴⽩㹬൥ਠ㱰㍯⁢㵭∠⵳∠㹳†㰠⽬㍮㹥മ਼㱢㸠 †⁳⁥†⁢⁔†⁳⸠⁴†⁥†⁰††⁥⁧ㅨ⥴†⁥⁨†⁹⁡†⡴⁩⤾Ⰽ ㉔⥨⁥⁢⁥⁶ⱥ⁣㍩⥦⁩††⁣†⁦⁴ⱴ†㑣⥨⁡⁧†⁴⁡‬⁡†⁳⁰⁦⁴ⱨ†㕭⥡⁴⁩⁡⁥‮⁰⁡⁥† †‼ ☠㬾⁔‍⸠‼⁔‾†⁴‍⁨   ㌀ ⸀㰀 ⼀㸀ഀ਀䤀☀㬀           ⸀ 䤀          ⠀  ⤀         Ⰰ             ⸀ 䘀 Ⰰ                    ⸀㰀 ⼀㸀ഀ਀        ☀㬀 ㈀ ⠀⤀☀㬀   䌀⸀㰀⼀㸀

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!