diff options
author | Tor Norbye <tnorbye@google.com> | 2013-05-31 07:45:51 -0700 |
---|---|---|
committer | Tor Norbye <tnorbye@google.com> | 2013-05-31 07:45:51 -0700 |
commit | ec3fb1e06285c0467a7a20360ca80453bc7635d4 (patch) | |
tree | 2402cdec34611f34b8385ff45387d6734bf6f994 /spellchecker | |
parent | a6eac331b3d9f0d4168b12356ea256c83f4e9c05 (diff) | |
download | idea-ec3fb1e06285c0467a7a20360ca80453bc7635d4.tar.gz |
Snapshot 568f05589922685b8c8f9a2f2f465043b8128542 from master branch of git://git.jetbrains.org/idea/community.git
Change-Id: I47fe8cb5d8a3c9876cd4c313dca1a8cc531288ec
Diffstat (limited to 'spellchecker')
4 files changed, 15 insertions, 66 deletions
diff --git a/spellchecker/src/com/intellij/spellchecker/engine/BaseSpellChecker.java b/spellchecker/src/com/intellij/spellchecker/engine/BaseSpellChecker.java index f460706784d8..dc4e2ff9d2f7 100644 --- a/spellchecker/src/com/intellij/spellchecker/engine/BaseSpellChecker.java +++ b/spellchecker/src/com/intellij/spellchecker/engine/BaseSpellChecker.java @@ -26,6 +26,7 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.project.ProjectManager; import com.intellij.openapi.startup.StartupManager; import com.intellij.openapi.util.Pair; +import com.intellij.openapi.util.text.LevenshteinDistance; import com.intellij.openapi.util.text.StringUtil; import com.intellij.spellchecker.compress.CompressedDictionary; import com.intellij.spellchecker.dictionary.Dictionary; @@ -49,7 +50,7 @@ public class BaseSpellChecker implements SpellCheckerEngine { private final Set<EditableDictionary> dictionaries = new HashSet<EditableDictionary>(); private final List<Dictionary> bundledDictionaries = ContainerUtil.createLockFreeCopyOnWriteList(); - private final Metrics metrics = new LevenshteinDistance(); + private final LevenshteinDistance metrics = new LevenshteinDistance(); private final AtomicBoolean myLoadingDictionaries = new AtomicBoolean(false); private final List<Pair<Loader, Consumer<Dictionary>>> myDictionariesToLoad = ContainerUtil.createLockFreeCopyOnWriteList(); diff --git a/spellchecker/src/com/intellij/spellchecker/engine/LevenshteinDistance.java b/spellchecker/src/com/intellij/spellchecker/engine/LevenshteinDistance.java deleted file mode 100644 index 395e4ab86f9e..000000000000 --- a/spellchecker/src/com/intellij/spellchecker/engine/LevenshteinDistance.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.spellchecker.engine; - -public class LevenshteinDistance implements Metrics { - - private static int minimum(int a, int b, int c) { - return Math.min(Math.min(a, b), c); - } - - public int calculateMetrics(CharSequence str1, CharSequence str2) { - int[][] distance = new int[str1.length() + 1][str2.length() + 1]; - - for (int i = 0; i <= str1.length(); i++) { - distance[i][0] = i; - } - for (int j = 0; j <= str2.length(); j++) { - distance[0][j] = j; - } - - for (int i = 1; i <= str1.length(); i++) { - for (int j = 1; j <= str2.length(); j++) { - distance[i][j] = minimum(distance[i - 1][j] + 1, distance[i][j - 1] + 1, - distance[i - 1][j - 1] + ((str1.charAt(i - 1) == str2.charAt(j - 1)) ? 0 : 1)); - } - } - - return distance[str1.length()][str2.length()]; - } -} diff --git a/spellchecker/src/com/intellij/spellchecker/engine/Metrics.java b/spellchecker/src/com/intellij/spellchecker/engine/Metrics.java deleted file mode 100644 index c91a117cf90d..000000000000 --- a/spellchecker/src/com/intellij/spellchecker/engine/Metrics.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.spellchecker.engine; - - -public interface Metrics { - - int calculateMetrics(CharSequence str1, CharSequence str2); -} diff --git a/spellchecker/src/com/intellij/spellchecker/jetbrains.dic b/spellchecker/src/com/intellij/spellchecker/jetbrains.dic index b9c136cd1164..feef720e0750 100644 --- a/spellchecker/src/com/intellij/spellchecker/jetbrains.dic +++ b/spellchecker/src/com/intellij/spellchecker/jetbrains.dic @@ -3,12 +3,14 @@ aggregator ajax alloc anyschema +aopalliance appender archivelog args arial arity asensitive +aspectj attr attlist auth @@ -50,6 +52,7 @@ capath captcha ccflags cdata +cglib changelist charset checkbox @@ -102,6 +105,7 @@ desc deserializable deserializer deserializers +devkit dirs distinctrow django @@ -132,6 +136,7 @@ foreach formatter freelist freelists +freemarker freepools frontend ftlvariable @@ -139,6 +144,7 @@ fulltext func fxml gdata +gemfire geocode geometrycollection getters @@ -246,6 +252,7 @@ minvalue miny mixin mlslabel +mongodb monospaced multi multilinestring @@ -311,6 +318,7 @@ param params patcher patchers +pathname pctfree pctincrease pctthreshold @@ -354,6 +362,7 @@ rebase rebased rebasing rect +redis redistributions refactor refactored @@ -398,6 +407,8 @@ serializer serializers servererror servlet +servlets +sftp shader significand significands @@ -454,6 +465,7 @@ tokenize tokenizer tooltip tooltips +toplink trebuchet twitter typedef @@ -488,6 +500,7 @@ varray verdana versa vertices +viewlet vtlvariable watchlist webservice |