Ejemplo n.º 1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void terminate() throws org.maltparser.core.exception.MaltChainedException
        public override void terminate()
        {
            if (reader != null)
            {
                reader.close();
                reader = null;
            }
            cachedGraph             = null;
            inputDataFormatInstance = null;
        }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void initReader(Class syntaxGraphReader, String inputFile, String inputCharSet, String readerOptions, int iterations) throws org.maltparser.core.exception.MaltChainedException
        public virtual void initReader(Type syntaxGraphReader, string inputFile, string inputCharSet, string readerOptions, int iterations)
        {
            try
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.maltparser.core.helper.URLFinder f = new org.maltparser.core.helper.URLFinder();
                UrlFinder f = new UrlFinder();
                reader = Activator.CreateInstance(syntaxGraphReader);
                if (ReferenceEquals(inputFile, null) || inputFile.Length == 0 || inputFile.Equals("/dev/stdin"))
                {
                    reader.open(System.in, inputCharSet);
                }
                else if (Directory.Exists(inputFile) || File.Exists(inputFile))
                {
                    reader.NIterations = iterations;
                    reader.open(inputFile, inputCharSet);
                }
                else
                {
                    reader.NIterations = iterations;
                    reader.open(f.FindUrl(inputFile), inputCharSet);
                }
                reader.DataFormatInstance = inputDataFormatInstance;
                reader.Options            = readerOptions;
            }
            catch (InstantiationException e)
            {
//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method:
                throw new DataFormatException("The data reader '" + syntaxGraphReader.FullName + "' cannot be initialized. ", e);
            }
            catch (IllegalAccessException e)
            {
//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method:
                throw new DataFormatException("The data reader '" + syntaxGraphReader.FullName + "' cannot be initialized. ", e);
            }
        }