コード例 #1
0
ファイル: HeadRules.cs プロジェクト: Sojaner/NMaltParser
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void parseHeadRules(String fileName) throws org.maltparser.core.exception.MaltChainedException
        public virtual void parseHeadRules(string fileName)
        {
//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();

            parseHeadRules(f.FindUrl(fileName));
        }
コード例 #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void load(String urlstring) throws org.maltparser.core.exception.MaltChainedException
        public virtual void load(string urlstring)
        {
//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();

            load(f.FindUrl(urlstring));
        }
コード例 #3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void parseDataFormatXMLfile(String fileName) throws org.maltparser.core.exception.MaltChainedException
        public virtual void parseDataFormatXMLfile(string fileName)
        {
//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();
            URL       url = f.FindUrl(fileName);

            if (url == null)
            {
                throw new DataFormatException("The data format specifcation file '" + fileName + "'cannot be found. ");
            }
            parseDataFormatXMLfile(url);
        }
コード例 #4
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);
            }
        }