{"action":"created","comment":{"url":"https://api.github.com/repos/oppia/oppia/pulls/comments/46788514","id":46788514,"diff_hunk":"@@ -81,3 +82,56 @@ oppia.directive('oppiaShortResponseTextInput', [\n     };\n   }\n ]);\n+\n+oppia.factory('textInputRulesService', ['$filter', function($filter) {\n+  return {\n+    Equals: function(answer, inputs) {\n+      var normalizedAnswer = $filter('normalizeWhitespace')(answer);\n+      var normalizedInput = $filter('normalizeWhitespace')(inputs.x);\n+      return normalizedAnswer.toLowerCase() == normalizedInput.toLowerCase();\n+    },\n+    FuzzyEquals: function(answer, inputs) {\n+      var normalizedAnswer = $filter('normalizeWhitespace')(answer);\n+      var answerString = normalizedAnswer.toLowerCase();\n+\n+      var normalizedInput = $filter('normalizeWhitespace')(inputs.x);\n+      var inputString = normalizedInput.toLowerCase();\n+\n+      if(inputString == answerString) return true;\n+      var d = [];\n+      for(var i = 0; i <= inputString.length; i++){\n+        d.push([i]);\n+      }\n+      for(var j = 0; j <= answerString.length; j++){\n+        d[0].push(j);\n+      }\n+      for(i = 1; i <= inputString.length; i++){","path":"extensions/interactions/TextInput/TextInput.js","position":48,"original_position":48,"commit_id":"39fe6ed57aa4437e649fec1f6a8ace31d1551476","original_commit_id":"39fe6ed57aa4437e649fec1f6a8ace31d1551476","user":{"login":"wxyxinyu","id":5061134,"avatar_url":"https://avatars.githubusercontent.com/u/5061134?v=3","gravatar_id":"","url":"https://api.github.com/users/wxyxinyu","html_url":"https://github.com/wxyxinyu","followers_url":"https://api.github.com/users/wxyxinyu/followers","following_url":"https://api.github.com/users/wxyxinyu/following{/other_user}","gists_url":"https://api.github.com/users/wxyxinyu/gists{/gist_id}","starred_url":"https://api.github.com/users/wxyxinyu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wxyxinyu/subscriptions","organizations_url":"https://api.github.com/users/wxyxinyu/orgs","repos_url":"https://api.github.com/users/wxyxinyu/repos","events_url":"https://api.github.com/users/wxyxinyu/events{/privacy}","received_events_url":"https://api.github.com/users/wxyxinyu/received_events","type":"User","site_admin":false},"body":"Also, I'm slightly concerned about this loop, because it `d` doesn't contain the edit distance. The recurrence also produces wrong results on other inputs. (e.g. 'hello' and 'abcde' returns 5). I think you need to get the maximum over substitution, addition and deletion, instead of short-circuiting at substitution.","created_at":"2015-12-07T05:45:03Z","updated_at":"2015-12-07T05:45:03Z","html_url":"https://github.com/oppia/oppia/pull/1183#discussion_r46788514","pull_request_url":"https://api.github.com/repos/oppia/oppia/pulls/1183","_links":{"self":{"href":"https://api.github.com/repos/oppia/oppia/pulls/comments/46788514"},"html":{"href":"https://github.com/oppia/oppia/pull/1183#discussion_r46788514"},"pull_request":{"href":"https://api.github.com/repos/oppia/oppia/pulls/1183"}}},"pull_request":{"url":"https://api.github.com/repos/oppia/oppia/pulls/1183","id":52088724,"html_url":"https://github.com/oppia/oppia/pull/1183","diff_url":"https://github.com/oppia/oppia/pull/1183.diff","patch_url":"https://github.com/oppia/oppia/pull/1183.patch","issue_url":"https://api.github.com/repos/oppia/oppia/issues/1183","number":1183,"state":"open","locked":false,"title":"Migrated text input rules to frontend","user":{"login":"kahkhang","id":4048170,"avatar_url":"https://avatars.githubusercontent.com/u/4048170?v=3","gravatar_id":"","url":"https://api.github.com/users/kahkhang","html_url":"https://github.com/kahkhang","followers_url":"https://api.github.com/users/kahkhang/followers","following_url":"https://api.github.com/users/kahkhang/following{/other_user}","gists_url":"https://api.github.com/users/kahkhang/gists{/gist_id}","starred_url":"https://api.github.com/users/kahkhang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kahkhang/subscriptions","organizations_url":"https://api.github.com/users/kahkhang/orgs","repos_url":"https://api.github.com/users/kahkhang/repos","events_url":"https://api.github.com/users/kahkhang/events{/privacy}","received_events_url":"https://api.github.com/users/kahkhang/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-11-30T06:15:19Z","updated_at":"2015-12-07T05:45:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a10e6a15a3151711b2fff1443c4ada0a4cbe2be7","assignee":{"login":"wxyxinyu","id":5061134,"avatar_url":"https://avatars.githubusercontent.com/u/5061134?v=3","gravatar_id":"","url":"https://api.github.com/users/wxyxinyu","html_url":"https://github.com/wxyxinyu","followers_url":"https://api.github.com/users/wxyxinyu/followers","following_url":"https://api.github.com/users/wxyxinyu/following{/other_user}","gists_url":"https://api.github.com/users/wxyxinyu/gists{/gist_id}","starred_url":"https://api.github.com/users/wxyxinyu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wxyxinyu/subscriptions","organizations_url":"https://api.github.com/users/wxyxinyu/orgs","repos_url":"https://api.github.com/users/wxyxinyu/repos","events_url":"https://api.github.com/users/wxyxinyu/events{/privacy}","received_events_url":"https://api.github.com/users/wxyxinyu/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/oppia/oppia/pulls/1183/commits","review_comments_url":"https://api.github.com/repos/oppia/oppia/pulls/1183/comments","review_comment_url":"https://api.github.com/repos/oppia/oppia/pulls/comments{/number}","comments_url":"https://api.github.com/repos/oppia/oppia/issues/1183/comments","statuses_url":"https://api.github.com/repos/oppia/oppia/statuses/39fe6ed57aa4437e649fec1f6a8ace31d1551476","head":{"label":"kahkhang:text-input-frontend-rules","ref":"text-input-frontend-rules","sha":"39fe6ed57aa4437e649fec1f6a8ace31d1551476","user":{"login":"kahkhang","id":4048170,"avatar_url":"https://avatars.githubusercontent.com/u/4048170?v=3","gravatar_id":"","url":"https://api.github.com/users/kahkhang","html_url":"https://github.com/kahkhang","followers_url":"https://api.github.com/users/kahkhang/followers","following_url":"https://api.github.com/users/kahkhang/following{/other_user}","gists_url":"https://api.github.com/users/kahkhang/gists{/gist_id}","starred_url":"https://api.github.com/users/kahkhang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kahkhang/subscriptions","organizations_url":"https://api.github.com/users/kahkhang/orgs","repos_url":"https://api.github.com/users/kahkhang/repos","events_url":"https://api.github.com/users/kahkhang/events{/privacy}","received_events_url":"https://api.github.com/users/kahkhang/received_events","type":"User","site_admin":false},"repo":{"id":47031815,"name":"oppia","full_name":"kahkhang/oppia","owner":{"login":"kahkhang","id":4048170,"avatar_url":"https://avatars.githubusercontent.com/u/4048170?v=3","gravatar_id":"","url":"https://api.github.com/users/kahkhang","html_url":"https://github.com/kahkhang","followers_url":"https://api.github.com/users/kahkhang/followers","following_url":"https://api.github.com/users/kahkhang/following{/other_user}","gists_url":"https://api.github.com/users/kahkhang/gists{/gist_id}","starred_url":"https://api.github.com/users/kahkhang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kahkhang/subscriptions","organizations_url":"https://api.github.com/users/kahkhang/orgs","repos_url":"https://api.github.com/users/kahkhang/repos","events_url":"https://api.github.com/users/kahkhang/events{/privacy}","received_events_url":"https://api.github.com/users/kahkhang/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kahkhang/oppia","description":"Tool for collaboratively building interactive tutors.","fork":true,"url":"https://api.github.com/repos/kahkhang/oppia","forks_url":"https://api.github.com/repos/kahkhang/oppia/forks","keys_url":"https://api.github.com/repos/kahkhang/oppia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kahkhang/oppia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kahkhang/oppia/teams","hooks_url":"https://api.github.com/repos/kahkhang/oppia/hooks","issue_events_url":"https://api.github.com/repos/kahkhang/oppia/issues/events{/number}","events_url":"https://api.github.com/repos/kahkhang/oppia/events","assignees_url":"https://api.github.com/repos/kahkhang/oppia/assignees{/user}","branches_url":"https://api.github.com/repos/kahkhang/oppia/branches{/branch}","tags_url":"https://api.github.com/repos/kahkhang/oppia/tags","blobs_url":"https://api.github.com/repos/kahkhang/oppia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kahkhang/oppia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kahkhang/oppia/git/refs{/sha}","trees_url":"https://api.github.com/repos/kahkhang/oppia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kahkhang/oppia/statuses/{sha}","languages_url":"https://api.github.com/repos/kahkhang/oppia/languages","stargazers_url":"https://api.github.com/repos/kahkhang/oppia/stargazers","contributors_url":"https://api.github.com/repos/kahkhang/oppia/contributors","subscribers_url":"https://api.github.com/repos/kahkhang/oppia/subscribers","subscription_url":"https://api.github.com/repos/kahkhang/oppia/subscription","commits_url":"https://api.github.com/repos/kahkhang/oppia/commits{/sha}","git_commits_url":"https://api.github.com/repos/kahkhang/oppia/git/commits{/sha}","comments_url":"https://api.github.com/repos/kahkhang/oppia/comments{/number}","issue_comment_url":"https://api.github.com/repos/kahkhang/oppia/issues/comments{/number}","contents_url":"https://api.github.com/repos/kahkhang/oppia/contents/{+path}","compare_url":"https://api.github.com/repos/kahkhang/oppia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kahkhang/oppia/merges","archive_url":"https://api.github.com/repos/kahkhang/oppia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kahkhang/oppia/downloads","issues_url":"https://api.github.com/repos/kahkhang/oppia/issues{/number}","pulls_url":"https://api.github.com/repos/kahkhang/oppia/pulls{/number}","milestones_url":"https://api.github.com/repos/kahkhang/oppia/milestones{/number}","notifications_url":"https://api.github.com/repos/kahkhang/oppia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kahkhang/oppia/labels{/name}","releases_url":"https://api.github.com/repos/kahkhang/oppia/releases{/id}","created_at":"2015-11-28T16:57:35Z","updated_at":"2015-11-28T16:57:40Z","pushed_at":"2015-12-07T03:53:12Z","git_url":"git://github.com/kahkhang/oppia.git","ssh_url":"git@github.com:kahkhang/oppia.git","clone_url":"https://github.com/kahkhang/oppia.git","svn_url":"https://github.com/kahkhang/oppia","homepage":"https://www.oppia.org","size":39083,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"oppia:develop","ref":"develop","sha":"61eb287ae546450450de8c78ff9311d4aef329ec","user":{"login":"oppia","id":11620230,"avatar_url":"https://avatars.githubusercontent.com/u/11620230?v=3","gravatar_id":"","url":"https://api.github.com/users/oppia","html_url":"https://github.com/oppia","followers_url":"https://api.github.com/users/oppia/followers","following_url":"https://api.github.com/users/oppia/following{/other_user}","gists_url":"https://api.github.com/users/oppia/gists{/gist_id}","starred_url":"https://api.github.com/users/oppia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oppia/subscriptions","organizations_url":"https://api.github.com/users/oppia/orgs","repos_url":"https://api.github.com/users/oppia/repos","events_url":"https://api.github.com/users/oppia/events{/privacy}","received_events_url":"https://api.github.com/users/oppia/received_events","type":"Organization","site_admin":false},"repo":{"id":40687563,"name":"oppia","full_name":"oppia/oppia","owner":{"login":"oppia","id":11620230,"avatar_url":"https://avatars.githubusercontent.com/u/11620230?v=3","gravatar_id":"","url":"https://api.github.com/users/oppia","html_url":"https://github.com/oppia","followers_url":"https://api.github.com/users/oppia/followers","following_url":"https://api.github.com/users/oppia/following{/other_user}","gists_url":"https://api.github.com/users/oppia/gists{/gist_id}","starred_url":"https://api.github.com/users/oppia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oppia/subscriptions","organizations_url":"https://api.github.com/users/oppia/orgs","repos_url":"https://api.github.com/users/oppia/repos","events_url":"https://api.github.com/users/oppia/events{/privacy}","received_events_url":"https://api.github.com/users/oppia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/oppia/oppia","description":"Tool for collaboratively building interactive tutors.","fork":false,"url":"https://api.github.com/repos/oppia/oppia","forks_url":"https://api.github.com/repos/oppia/oppia/forks","keys_url":"https://api.github.com/repos/oppia/oppia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/oppia/oppia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/oppia/oppia/teams","hooks_url":"https://api.github.com/repos/oppia/oppia/hooks","issue_events_url":"https://api.github.com/repos/oppia/oppia/issues/events{/number}","events_url":"https://api.github.com/repos/oppia/oppia/events","assignees_url":"https://api.github.com/repos/oppia/oppia/assignees{/user}","branches_url":"https://api.github.com/repos/oppia/oppia/branches{/branch}","tags_url":"https://api.github.com/repos/oppia/oppia/tags","blobs_url":"https://api.github.com/repos/oppia/oppia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/oppia/oppia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/oppia/oppia/git/refs{/sha}","trees_url":"https://api.github.com/repos/oppia/oppia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/oppia/oppia/statuses/{sha}","languages_url":"https://api.github.com/repos/oppia/oppia/languages","stargazers_url":"https://api.github.com/repos/oppia/oppia/stargazers","contributors_url":"https://api.github.com/repos/oppia/oppia/contributors","subscribers_url":"https://api.github.com/repos/oppia/oppia/subscribers","subscription_url":"https://api.github.com/repos/oppia/oppia/subscription","commits_url":"https://api.github.com/repos/oppia/oppia/commits{/sha}","git_commits_url":"https://api.github.com/repos/oppia/oppia/git/commits{/sha}","comments_url":"https://api.github.com/repos/oppia/oppia/comments{/number}","issue_comment_url":"https://api.github.com/repos/oppia/oppia/issues/comments{/number}","contents_url":"https://api.github.com/repos/oppia/oppia/contents/{+path}","compare_url":"https://api.github.com/repos/oppia/oppia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/oppia/oppia/merges","archive_url":"https://api.github.com/repos/oppia/oppia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/oppia/oppia/downloads","issues_url":"https://api.github.com/repos/oppia/oppia/issues{/number}","pulls_url":"https://api.github.com/repos/oppia/oppia/pulls{/number}","milestones_url":"https://api.github.com/repos/oppia/oppia/milestones{/number}","notifications_url":"https://api.github.com/repos/oppia/oppia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/oppia/oppia/labels{/name}","releases_url":"https://api.github.com/repos/oppia/oppia/releases{/id}","created_at":"2015-08-14T00:16:14Z","updated_at":"2015-12-04T11:29:32Z","pushed_at":"2015-12-07T03:53:12Z","git_url":"git://github.com/oppia/oppia.git","ssh_url":"git@github.com:oppia/oppia.git","clone_url":"https://github.com/oppia/oppia.git","svn_url":"https://github.com/oppia/oppia","homepage":"https://www.oppia.org","size":44389,"stargazers_count":62,"watchers_count":62,"language":"Python","has_issues":true,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":82,"mirror_url":null,"open_issues_count":228,"forks":82,"open_issues":228,"watchers":62,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/oppia/oppia/pulls/1183"},"html":{"href":"https://github.com/oppia/oppia/pull/1183"},"issue":{"href":"https://api.github.com/repos/oppia/oppia/issues/1183"},"comments":{"href":"https://api.github.com/repos/oppia/oppia/issues/1183/comments"},"review_comments":{"href":"https://api.github.com/repos/oppia/oppia/pulls/1183/comments"},"review_comment":{"href":"https://api.github.com/repos/oppia/oppia/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/oppia/oppia/pulls/1183/commits"},"statuses":{"href":"https://api.github.com/repos/oppia/oppia/statuses/39fe6ed57aa4437e649fec1f6a8ace31d1551476"}}}}