You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by us...@apache.org on 2013/10/16 12:26:33 UTC

svn commit: r1532707 - in /lucene/dev/branches/lucene4956/lucene/analysis/arirang/src: java/org/apache/lucene/analysis/ko/ java/org/apache/lucene/analysis/ko/dic/ java/org/apache/lucene/analysis/ko/morph/ java/org/apache/lucene/analysis/ko/tagging/ jav...

Author: uschindler
Date: Wed Oct 16 10:26:32 2013
New Revision: 1532707

URL: http://svn.apache.org/r1532707
Log:
LUCENE-4956: First step in remove buggy resources stuff:
- no more properties file
- Moved files into correct packages
- Removed KoreanEnv, DictionaryResources is new class

Still needs more refactoring!

Added:
    lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/dic/
    lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/dic/DictionaryResources.java
      - copied, changed from r1532692, lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/FileUtil.java
    lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/dic/DictionaryUtil.java
      - copied, changed from r1532692, lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/DictionaryUtil.java
    lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/resources/org/apache/lucene/analysis/ko/dic/dictionary.dic
      - copied unchanged from r1532692, lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/resources/org/apache/lucene/analysis/ko/dic/total.dic
    lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/resources/org/apache/lucene/analysis/ko/dic/tagger.dic
      - copied unchanged from r1532692, lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/resources/org/apache/lucene/analysis/ko/dic/occurrence.dic
Removed:
    lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/DictionaryUtil.java
    lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/FileUtil.java
    lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/JarResources.java
    lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/KoreanEnv.java
    lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/resources/org/apache/lucene/analysis/ko/dic/occurrence.dic
    lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/resources/org/apache/lucene/analysis/ko/dic/total.dic
    lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/resources/org/apache/lucene/analysis/ko/korean.properties
Modified:
    lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/KoreanFilter.java
    lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/morph/AbbrevAnalyzer.java
    lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/morph/CompoundNounAnalyzer.java
    lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/morph/MorphAnalyzer.java
    lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/morph/WordSpaceAnalyzer.java
    lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/tagging/Tagger.java
    lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/EomiUtil.java
    lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/HanjaUtils.java
    lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/IrregularUtil.java
    lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/MorphUtil.java
    lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/NounUtil.java
    lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/StrBuilder.java
    lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/SyllableUtil.java
    lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/VerbUtil.java

Modified: lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/KoreanFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/KoreanFilter.java?rev=1532707&r1=1532706&r2=1532707&view=diff
==============================================================================
--- lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/KoreanFilter.java (original)
+++ lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/KoreanFilter.java Wed Oct 16 10:26:32 2013
@@ -29,6 +29,7 @@ import java.util.Map;
 
 import org.apache.lucene.analysis.TokenFilter;
 import org.apache.lucene.analysis.TokenStream;
+import org.apache.lucene.analysis.ko.dic.DictionaryUtil;
 import org.apache.lucene.analysis.ko.morph.AnalysisOutput;
 import org.apache.lucene.analysis.ko.morph.CompoundEntry;
 import org.apache.lucene.analysis.ko.morph.CompoundNounAnalyzer;
@@ -37,7 +38,6 @@ import org.apache.lucene.analysis.ko.mor
 import org.apache.lucene.analysis.ko.morph.PatternConstants;
 import org.apache.lucene.analysis.ko.morph.WordEntry;
 import org.apache.lucene.analysis.ko.morph.WordSpaceAnalyzer;
-import org.apache.lucene.analysis.ko.utils.DictionaryUtil;
 import org.apache.lucene.analysis.ko.utils.HanjaUtils;
 import org.apache.lucene.analysis.ko.IndexWord;
 import org.apache.lucene.analysis.ko.KoreanTokenizer;

Copied: lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/dic/DictionaryResources.java (from r1532692, lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/FileUtil.java)
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/dic/DictionaryResources.java?p2=lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/dic/DictionaryResources.java&p1=lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/FileUtil.java&r1=1532692&r2=1532707&rev=1532707&view=diff
==============================================================================
--- lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/FileUtil.java (original)
+++ lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/dic/DictionaryResources.java Wed Oct 16 10:26:32 2013
@@ -1,4 +1,4 @@
-package org.apache.lucene.analysis.ko.utils;
+package org.apache.lucene.analysis.ko.dic;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -18,182 +18,60 @@ package org.apache.lucene.analysis.ko.ut
  */
 
 import java.io.BufferedReader;
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.Reader;
-import java.net.URL;
+import java.nio.charset.Charset;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.lucene.analysis.ko.morph.MorphException;
+import org.apache.lucene.util.IOUtils;
 
 /**
  * file utility class
  */
-public class FileUtil {
+public class DictionaryResources {
   
-  /**
-   * Given a file name for a file that is located somewhere in the application
-   * classpath, return a File object representing the file.
-   *
-   * @param filename The name of the file (relative to the classpath) that is
-   *  to be retrieved.
-   * @return A file object representing the requested filename
-   * @throws MorphException Thrown if the classloader can not be found or if
-   *  the file can not be found in the classpath.
-   */
-  public static File getClassLoaderFile(String filename) throws MorphException  {
-    // note that this method is used when initializing logging, so it must
-    // not attempt to log anything.
-    File file = null;
-    ClassLoader loader = FileUtil.class.getClassLoader();
-    URL url = loader.getResource(filename);
-    if (url == null) {
-      url = ClassLoader.getSystemResource(filename);
-      if (url == null) {
-        throw new MorphException("Unable to find " + filename);
-      }
-      file = toFile(url);
-    } else {
-      file = toFile(url);
-    }
-    if (file==null||!file.exists()) {
-      return null;
-    }
-    return file;
-  }
+  public static final String FILE_SYLLABLE_FEATURE = "syllable.dic";
   
-  /**
-   * Reads the contents of a file line by line to a List of Strings.
-   * The file is always closed.
-   *
-   * @param file  the file to read, must not be <code>null</code>
-   * @param encoding  the encoding to use, <code>null</code> means platform default
-   * @return the list of Strings representing each line in the file, never <code>null</code>
-   * @throws IOException in case of an I/O error
-   * @throws java.io.UnsupportedEncodingException if the encoding is not supported by the VM
-   * @since Commons IO 1.1
-   */
-  public static List<String> readLines(File file, String encoding) throws IOException {
-    InputStream in = null;
-    try {
-      in = openInputStream(file);
-      return readLines(in, encoding);
-    } finally {
-      closeQuietly(in);
-    }
-  }
+  public static final String FILE_DICTIONARY = "dictionary.dic";  
+  
+  public static final String FILE_JOSA = "josa.dic";
+  
+  public static final String FILE_EOMI = "eomi.dic";
+  
+  public static final String FILE_EXTENSION = "extension.dic";
+  
+  public static final String FILE_PREFIX = "prefix.dic";
+  
+  public static final String FILE_SUFFIX = "suffix.dic";  
+  
+  public static final String FILE_COMPOUNDS = "compounds.dic";  
+  
+  public static final String FILE_UNCOMPOUNDS = "uncompounds.dic";
     
-  /**
-   * Reads the contents of a file line by line to a List of Strings.
-   * The file is always closed.
-   *
-   * @param fName  the file to read, must not be <code>null</code>
-   * @param encoding  the encoding to use, <code>null</code> means platform default
-   * @return the list of Strings representing each line in the file, never <code>null</code>
-   * @throws MorphException  throw exception
-   * @throws IOException  throw exception
-   * @throws java.io.UnsupportedEncodingException if the encoding is not supported by the VM
-   * @since Commons IO 1.1
-   */
-  public static List<String> readLines(String fName, String encoding) throws MorphException, IOException  {
-    InputStream in = null;        
-    try {
+  public static final String FILE_ABBREV = "abbreviation.dic";
+  
+  public static final String FILE_CJ = "cj.dic";
+  
+  public static final String FILE_TAG_DIC = "tagger.dic";
+  
+  public static final String FILE_MAP_HANJA_DIC = "mapHanja.dic";
 
-      File file = getClassLoaderFile(fName);
-      if(file!=null&&file.exists()) {
-        in = openInputStream(file);
-      } else {
-        in = new ByteArrayInputStream(readByteFromCurrentJar(fName));
-      }
-        
-      return readLines(in, encoding);
-    } finally {
-      closeQuietly(in);
-    }
-  }
-    
-  //-----------------------------------------------------------------------
-  /**
-   * Opens a {@link FileInputStream} for the specified file, providing better
-   * error messages than simply calling <code>new FileInputStream(file)</code>.
-   * <p>
-   * At the end of the method either the stream will be successfully opened,
-   * or an exception will have been thrown.
-   * <p>
-   * An exception is thrown if the file does not exist.
-   * An exception is thrown if the file object exists but is a directory.
-   * An exception is thrown if the file exists but cannot be read.
-   * 
-   * @param file  the file to open for input, must not be <code>null</code>
-   * @return a new {@link FileInputStream} for the specified file
-   * @throws FileNotFoundException if the file does not exist
-   * @throws IOException if the file object is a directory
-   * @throws IOException if the file cannot be read
-   * @since Commons IO 1.3
-   */
-  public static FileInputStream openInputStream(File file) throws IOException {
-    if (file.exists()) {
-      if (file.isDirectory()) {
-        throw new IOException("File '" + file + "' exists but is a directory");
-      }
-      if (file.canRead() == false) {
-        throw new IOException("File '" + file + "' cannot be read");
-      }
-    } else {
-      throw new FileNotFoundException("File '" + file + "' does not exist");
-    }
-    return new FileInputStream(file);
-  }
-    
-  // readLines
-  //-----------------------------------------------------------------------
-  /**
-   * Get the contents of an <code>InputStream</code> as a list of Strings,
-   * one entry per line, using the default character encoding of the platform.
-   * <p>
-   * This method buffers the input internally, so there is no need to use a
-   * <code>BufferedInputStream</code>.
-   *
-   * @param input  the <code>InputStream</code> to read from, not null
-   * @return the list of Strings, never null
-   * @throws NullPointerException if the input is null
-   * @throws IOException if an I/O error occurs
-   * @since Commons IO 1.1
-   */
-  public static List<String> readLines(InputStream input) throws IOException {
-    InputStreamReader reader = new InputStreamReader(input);
-    return readLines(reader);
-  }
 
-  /**
-   * Get the contents of an <code>InputStream</code> as a list of Strings,
-   * one entry per line, using the specified character encoding.
-   * <p>
-   * Character encoding names can be found at
-   * <a href="http://www.iana.org/assignments/character-sets">IANA</a>.
-   * <p>
-   * This method buffers the input internally, so there is no need to use a
-   * <code>BufferedInputStream</code>.
-   *
-   * @param input  the <code>InputStream</code> to read from, not null
-   * @param encoding  the encoding to use, null means platform default
-   * @return the list of Strings, never null
-   * @throws NullPointerException if the input is null
-   * @throws IOException if an I/O error occurs
-   * @since Commons IO 1.1
-   */
-  public static List<String> readLines(InputStream input, String encoding) throws IOException {
-    if (encoding == null) {
-      return readLines(input);
-    } else {
-      InputStreamReader reader = new InputStreamReader(input, encoding);
-      return readLines(reader);
+  private DictionaryResources() {}
+
+  public static List<String> readLines(String file) throws IOException {
+    InputStream in = null;
+    try {
+      in = DictionaryResources.class.getResourceAsStream(file);
+      if (in == null)
+        throw new FileNotFoundException(file);
+      return readLines(new InputStreamReader(in, IOUtils.CHARSET_UTF_8));
+    } finally {
+      IOUtils.closeWhileHandlingException(in);
     }
   }
 
@@ -210,7 +88,7 @@ public class FileUtil {
    * @throws IOException if an I/O error occurs
    * @since Commons IO 1.1
    */
-  public static List<String> readLines(Reader input) throws IOException {
+  private static List<String> readLines(Reader input) throws IOException {
     BufferedReader reader = new BufferedReader(input);
     List<String> list = new ArrayList<String>();
     String line = reader.readLine();
@@ -222,66 +100,5 @@ public class FileUtil {
     }
     return list;
   }
-    
-  /**
-   * Unconditionally close an <code>InputStream</code>.
-   * <p>
-   * Equivalent to {@link InputStream#close()}, except any exceptions will be ignored.
-   * This is typically used in finally blocks.
-   *
-   * @param input  the InputStream to close, may be null or already closed
-   */
-  public static void closeQuietly(InputStream input) {
-    try {
-      if (input != null) {
-        input.close();
-      }
-    } catch (IOException ioe) {
-      // ignore
-    }
-  }
-    
-    
 
-  //-----------------------------------------------------------------------
-  /**
-   * Convert from a <code>URL</code> to a <code>File</code>.
-   * <p>
-   * From version 1.1 this method will decode the URL.
-   * Syntax such as <code>file:///my%20docs/file.txt</code> will be
-   * correctly decoded to <code>/my docs/file.txt</code>.
-   *
-   * @param url  the file URL to convert, <code>null</code> returns <code>null</code>
-   * @return the equivalent <code>File</code> object, or <code>null</code>
-   *  if the URL's protocol is not <code>file</code>
-   * @throws IllegalArgumentException if the file is incorrectly encoded
-   */
-  public static File toFile(URL url) {
-    if (url == null || !url.getProtocol().equals("file")) {
-      return null;
-    } else {
-      String filename = url.getFile().replace('/', File.separatorChar);
-      int pos =0;
-      while ((pos = filename.indexOf('%', pos)) >= 0) {
-        if (pos + 2 < filename.length()) {
-          String hexStr = filename.substring(pos + 1, pos + 3);
-          char ch = (char) Integer.parseInt(hexStr, 16);
-          filename = filename.substring(0, pos) + ch + filename.substring(pos + 3);
-        }
-      }
-      return new File(filename);
-    }
-  }
-
-  public static byte[] readByteFromCurrentJar(String resource) throws MorphException {
-
-    String  jarPath = FileUtil.class.getProtectionDomain().getCodeSource().getLocation().getPath();
-
-    JarResources jar = new JarResources(jarPath);
-    try {  
-      return jar.getResource(resource);
-    } catch (Exception e) {
-      throw new MorphException(e.getMessage(),e);
-    }
-  }
 }

Copied: lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/dic/DictionaryUtil.java (from r1532692, lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/DictionaryUtil.java)
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/dic/DictionaryUtil.java?p2=lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/dic/DictionaryUtil.java&p1=lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/DictionaryUtil.java&r1=1532692&r2=1532707&rev=1532707&view=diff
==============================================================================
--- lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/DictionaryUtil.java (original)
+++ lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/dic/DictionaryUtil.java Wed Oct 16 10:26:32 2013
@@ -1,4 +1,4 @@
-package org.apache.lucene.analysis.ko.utils;
+package org.apache.lucene.analysis.ko.dic;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -26,6 +26,7 @@ import java.util.List;
 import org.apache.lucene.analysis.ko.morph.CompoundEntry;
 import org.apache.lucene.analysis.ko.morph.MorphException;
 import org.apache.lucene.analysis.ko.morph.WordEntry;
+import org.apache.lucene.analysis.ko.utils.Trie;
 
 public class DictionaryUtil {
   
@@ -55,10 +56,10 @@ public class DictionaryUtil {
     List<String> compounds = null;
     List<String> abbrevs = null;
     try {
-      strList = FileUtil.readLines(KoreanEnv.getInstance().getValue(KoreanEnv.FILE_DICTIONARY),"UTF-8");
-      strList.addAll(FileUtil.readLines(KoreanEnv.getInstance().getValue(KoreanEnv.FILE_EXTENSION),"UTF-8"));
-      compounds = FileUtil.readLines(KoreanEnv.getInstance().getValue(KoreanEnv.FILE_COMPOUNDS),"UTF-8"); 
-      abbrevs = FileUtil.readLines(KoreanEnv.getInstance().getValue(KoreanEnv.FILE_ABBREV),"UTF-8"); 
+      strList = DictionaryResources.readLines(DictionaryResources.FILE_DICTIONARY);
+      strList.addAll(DictionaryResources.readLines(DictionaryResources.FILE_EXTENSION));
+      compounds = DictionaryResources.readLines(DictionaryResources.FILE_COMPOUNDS); 
+      abbrevs = DictionaryResources.readLines(DictionaryResources.FILE_ABBREV); 
     } catch (IOException e) {      
       new MorphException(e.getMessage(),e);
     } catch (Exception e) {
@@ -215,7 +216,7 @@ public class DictionaryUtil {
     try {
       if(uncompounds==null) {
         uncompounds = new HashMap<String,WordEntry>();
-        List<String> lines = FileUtil.readLines(KoreanEnv.getInstance().getValue(KoreanEnv.FILE_UNCOMPOUNDS),"UTF-8");  
+        List<String> lines = DictionaryResources.readLines(DictionaryResources.FILE_UNCOMPOUNDS);  
         for(String compound: lines) {    
           String[] infos = compound.split("[:]+");
           if(infos.length!=2) continue;
@@ -235,7 +236,7 @@ public class DictionaryUtil {
     try {
       if(cjwords==null) {
         cjwords = new HashMap<String, String>();
-        List<String> lines = FileUtil.readLines(KoreanEnv.getInstance().getValue(KoreanEnv.FILE_CJ),"UTF-8");  
+        List<String> lines = DictionaryResources.readLines(DictionaryResources.FILE_CJ);  
         for(String cj: lines) {    
           String[] infos = cj.split("[:]+");
           if(infos.length!=2) continue;
@@ -252,7 +253,7 @@ public class DictionaryUtil {
   public static boolean existJosa(String str) throws MorphException {
     if(josas==null) {
       josas = new HashMap<String, String>();
-      readFile(josas,KoreanEnv.FILE_JOSA);
+      readFile(josas,DictionaryResources.FILE_JOSA);
     }  
     if(josas.get(str)==null) return false;
     else return true;
@@ -261,7 +262,7 @@ public class DictionaryUtil {
   public static boolean existEomi(String str)  throws MorphException {
     if(eomis==null) {
       eomis = new HashMap<String, String>();
-      readFile(eomis,KoreanEnv.FILE_EOMI);
+      readFile(eomis,DictionaryResources.FILE_EOMI);
     }
 
     if(eomis.get(str)==null) return false;
@@ -271,7 +272,7 @@ public class DictionaryUtil {
   public static boolean existPrefix(String str)  throws MorphException {
     if(prefixs==null) {
       prefixs = new HashMap<String, String>();
-      readFile(prefixs,KoreanEnv.FILE_PREFIX);
+      readFile(prefixs,DictionaryResources.FILE_PREFIX);
     }
 
     if(prefixs.get(str)==null) return false;
@@ -281,7 +282,7 @@ public class DictionaryUtil {
   public static boolean existSuffix(String str)  throws MorphException {
     if(suffixs==null) {
       suffixs = new HashMap<String, String>();
-      readFile(suffixs,KoreanEnv.FILE_SUFFIX);
+      readFile(suffixs,DictionaryResources.FILE_SUFFIX);
     }
 
     if(suffixs.get(str)!=null) return true;
@@ -315,11 +316,8 @@ public class DictionaryUtil {
    * @throws MorphException excepton
    */
   private static synchronized void readFile(HashMap<String, String> map, String dic) throws MorphException {    
-    
-    String path = KoreanEnv.getInstance().getValue(dic);
-
     try{
-      List<String> line = FileUtil.readLines(path,"UTF-8");
+      List<String> line = DictionaryResources.readLines(dic);
       for(int i=1;i<line.size();i++) {
         map.put(line.get(i).trim(), line.get(i));
       }

Modified: lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/morph/AbbrevAnalyzer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/morph/AbbrevAnalyzer.java?rev=1532707&r1=1532706&r2=1532707&view=diff
==============================================================================
--- lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/morph/AbbrevAnalyzer.java (original)
+++ lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/morph/AbbrevAnalyzer.java Wed Oct 16 10:26:32 2013
@@ -3,7 +3,7 @@ package org.apache.lucene.analysis.ko.mo
 import java.util.Iterator;
 import java.util.List;
 
-import org.apache.lucene.analysis.ko.utils.DictionaryUtil;
+import org.apache.lucene.analysis.ko.dic.DictionaryUtil;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more

Modified: lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/morph/CompoundNounAnalyzer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/morph/CompoundNounAnalyzer.java?rev=1532707&r1=1532706&r2=1532707&view=diff
==============================================================================
--- lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/morph/CompoundNounAnalyzer.java (original)
+++ lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/morph/CompoundNounAnalyzer.java Wed Oct 16 10:26:32 2013
@@ -23,8 +23,8 @@ import java.util.Arrays;
 import java.util.List;
 import java.util.regex.Pattern;
 
-import org.apache.lucene.analysis.ko.utils.DictionaryUtil;
 import org.apache.lucene.analysis.ko.utils.Utilities;
+import org.apache.lucene.analysis.ko.dic.DictionaryUtil;
 import org.apache.lucene.analysis.ko.morph.CompoundEntry;
 import org.apache.lucene.analysis.ko.morph.MorphException;
 import org.apache.lucene.analysis.ko.morph.PatternConstants;

Modified: lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/morph/MorphAnalyzer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/morph/MorphAnalyzer.java?rev=1532707&r1=1532706&r2=1532707&view=diff
==============================================================================
--- lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/morph/MorphAnalyzer.java (original)
+++ lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/morph/MorphAnalyzer.java Wed Oct 16 10:26:32 2013
@@ -22,8 +22,8 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 
+import org.apache.lucene.analysis.ko.dic.DictionaryUtil;
 import org.apache.lucene.analysis.ko.utils.ConstraintUtil;
-import org.apache.lucene.analysis.ko.utils.DictionaryUtil;
 import org.apache.lucene.analysis.ko.utils.EomiUtil;
 import org.apache.lucene.analysis.ko.utils.IrregularUtil;
 import org.apache.lucene.analysis.ko.utils.MorphUtil;

Modified: lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/morph/WordSpaceAnalyzer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/morph/WordSpaceAnalyzer.java?rev=1532707&r1=1532706&r2=1532707&view=diff
==============================================================================
--- lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/morph/WordSpaceAnalyzer.java (original)
+++ lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/morph/WordSpaceAnalyzer.java Wed Oct 16 10:26:32 2013
@@ -25,10 +25,10 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.lucene.analysis.ko.utils.DictionaryUtil;
 import org.apache.lucene.analysis.ko.utils.MorphUtil;
 import org.apache.lucene.analysis.ko.utils.SyllableUtil;
 import org.apache.lucene.analysis.ko.utils.VerbUtil;
+import org.apache.lucene.analysis.ko.dic.DictionaryUtil;
 import org.apache.lucene.analysis.ko.morph.AnalysisOutput;
 import org.apache.lucene.analysis.ko.morph.CompoundEntry;
 import org.apache.lucene.analysis.ko.morph.MorphAnalyzer;

Modified: lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/tagging/Tagger.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/tagging/Tagger.java?rev=1532707&r1=1532706&r2=1532707&view=diff
==============================================================================
--- lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/tagging/Tagger.java (original)
+++ lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/tagging/Tagger.java Wed Oct 16 10:26:32 2013
@@ -21,12 +21,11 @@ import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 
+import org.apache.lucene.analysis.ko.dic.DictionaryResources;
 import org.apache.lucene.analysis.ko.morph.AnalysisOutput;
 import org.apache.lucene.analysis.ko.morph.MorphException;
 import org.apache.lucene.analysis.ko.morph.PatternConstants;
 import org.apache.lucene.analysis.ko.utils.ConstraintUtil;
-import org.apache.lucene.analysis.ko.utils.FileUtil;
-import org.apache.lucene.analysis.ko.utils.KoreanEnv;
 import org.apache.lucene.analysis.ko.utils.Trie;
 
 /**
@@ -36,9 +35,7 @@ import org.apache.lucene.analysis.ko.uti
 public class Tagger {
     
   private static Trie<String, String[]> occurrences;
-  
-  private static final String tagDicLoc = "tagger.dic";
-  
+    
   private static final String NILL = "NILL";
   
   private static final String NOPATN = "0";
@@ -276,7 +273,7 @@ public class Tagger {
     
     try {
       
-      List<String> strs = FileUtil.readLines(KoreanEnv.getInstance().getValue(tagDicLoc), "UTF-8");
+      List<String> strs = DictionaryResources.readLines(DictionaryResources.FILE_TAG_DIC);
       
       for(String str : strs) {
         if(str==null) continue;
@@ -296,7 +293,7 @@ public class Tagger {
       }      
       
     } catch (Exception e) {
-      throw new MorphException("Fail to read the tagger dictionary.("+tagDicLoc+")\n"+e.getMessage());
+      throw new MorphException("Fail to read the tagger dictionary: "+e.getMessage());
     }
   }
 }

Modified: lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/EomiUtil.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/EomiUtil.java?rev=1532707&r1=1532706&r2=1532707&view=diff
==============================================================================
--- lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/EomiUtil.java (original)
+++ lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/EomiUtil.java Wed Oct 16 10:26:32 2013
@@ -20,6 +20,7 @@ package org.apache.lucene.analysis.ko.ut
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.lucene.analysis.ko.dic.DictionaryUtil;
 import org.apache.lucene.analysis.ko.morph.AnalysisOutput;
 import org.apache.lucene.analysis.ko.morph.MorphException;
 import org.apache.lucene.analysis.ko.morph.PatternConstants;

Modified: lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/HanjaUtils.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/HanjaUtils.java?rev=1532707&r1=1532706&r2=1532707&view=diff
==============================================================================
--- lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/HanjaUtils.java (original)
+++ lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/HanjaUtils.java Wed Oct 16 10:26:32 2013
@@ -22,6 +22,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.lucene.analysis.ko.dic.DictionaryResources;
 import org.apache.lucene.analysis.ko.morph.MorphException;
 
 public class HanjaUtils {
@@ -30,7 +31,7 @@ public class HanjaUtils {
   
   public synchronized static void loadDictionary() throws MorphException {
     try {
-      List<String> strList = FileUtil.readLines("org/apache/lucene/analysis/ko/dic/mapHanja.dic","UTF-8");
+      List<String> strList = DictionaryResources.readLines(DictionaryResources.FILE_MAP_HANJA_DIC);
       mapHanja = new HashMap<String, char[]>();    
     
       for(int i=0;i<strList.size();i++) {

Modified: lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/IrregularUtil.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/IrregularUtil.java?rev=1532707&r1=1532706&r2=1532707&view=diff
==============================================================================
--- lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/IrregularUtil.java (original)
+++ lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/IrregularUtil.java Wed Oct 16 10:26:32 2013
@@ -17,6 +17,7 @@ package org.apache.lucene.analysis.ko.ut
  * limitations under the License.
  */
 
+import org.apache.lucene.analysis.ko.dic.DictionaryUtil;
 import org.apache.lucene.analysis.ko.morph.MorphException;
 import org.apache.lucene.analysis.ko.morph.WordEntry;
 

Modified: lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/MorphUtil.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/MorphUtil.java?rev=1532707&r1=1532706&r2=1532707&view=diff
==============================================================================
--- lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/MorphUtil.java (original)
+++ lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/MorphUtil.java Wed Oct 16 10:26:32 2013
@@ -19,6 +19,7 @@ package org.apache.lucene.analysis.ko.ut
 
 import java.util.List;
 
+import org.apache.lucene.analysis.ko.dic.DictionaryUtil;
 import org.apache.lucene.analysis.ko.morph.AnalysisOutput;
 import org.apache.lucene.analysis.ko.morph.MorphException;
 import org.apache.lucene.analysis.ko.morph.PatternConstants;

Modified: lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/NounUtil.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/NounUtil.java?rev=1532707&r1=1532706&r2=1532707&view=diff
==============================================================================
--- lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/NounUtil.java (original)
+++ lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/NounUtil.java Wed Oct 16 10:26:32 2013
@@ -21,6 +21,7 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 
+import org.apache.lucene.analysis.ko.dic.DictionaryUtil;
 import org.apache.lucene.analysis.ko.morph.AnalysisOutput;
 import org.apache.lucene.analysis.ko.morph.CompoundEntry;
 import org.apache.lucene.analysis.ko.morph.MorphException;

Modified: lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/StrBuilder.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/StrBuilder.java?rev=1532707&r1=1532706&r2=1532707&view=diff
==============================================================================
--- lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/StrBuilder.java (original)
+++ lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/StrBuilder.java Wed Oct 16 10:26:32 2013
@@ -19,8 +19,6 @@ package org.apache.lucene.analysis.ko.ut
 
 import java.io.Reader;
 import java.io.Writer;
-import java.util.Collection;
-import java.util.Iterator;
 
 /**
  * Builds a string from constituent parts providing a more flexible and powerful API
@@ -72,13 +70,6 @@ public class StrBuilder implements Clone
   static final int CAPACITY = 32;
 
   /**
-   * Required for serialization support.
-   * 
-   * @see java.io.Serializable
-   */
-  private static final long serialVersionUID = 7628716375283629643L;
-
-  /**
    * An empty immutable <code>char</code> array.
    */
   public static final char[] EMPTY_CHAR_ARRAY = new char[0];

Modified: lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/SyllableUtil.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/SyllableUtil.java?rev=1532707&r1=1532706&r2=1532707&view=diff
==============================================================================
--- lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/SyllableUtil.java (original)
+++ lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/SyllableUtil.java Wed Oct 16 10:26:32 2013
@@ -21,6 +21,7 @@ import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.lucene.analysis.ko.dic.DictionaryResources;
 import org.apache.lucene.analysis.ko.morph.MorphException;
 
 public class SyllableUtil {
@@ -113,7 +114,7 @@ public class SyllableUtil {
     try{
       Syllables = new ArrayList<char[]>();
 
-      List<String> line = FileUtil.readLines(KoreanEnv.getInstance().getValue(KoreanEnv.FILE_SYLLABLE_FEATURE),"UTF-8");  
+      List<String> line = DictionaryResources.readLines(DictionaryResources.FILE_SYLLABLE_FEATURE);  
       for(int i=0;i<line.size();i++) {        
         if(i!=0)
           Syllables.add(line.get(i).toCharArray());

Modified: lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/VerbUtil.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/VerbUtil.java?rev=1532707&r1=1532706&r2=1532707&view=diff
==============================================================================
--- lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/VerbUtil.java (original)
+++ lucene/dev/branches/lucene4956/lucene/analysis/arirang/src/java/org/apache/lucene/analysis/ko/utils/VerbUtil.java Wed Oct 16 10:26:32 2013
@@ -21,6 +21,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.lucene.analysis.ko.dic.DictionaryUtil;
 import org.apache.lucene.analysis.ko.morph.AnalysisOutput;
 import org.apache.lucene.analysis.ko.morph.MorphException;
 import org.apache.lucene.analysis.ko.morph.PatternConstants;