public static OpinionMiningOutputResult ExecuteOpinionMiningInprocWithLinguisticService(
            XDocument rdf, bool callPreprocessRdf, ObjectAllocateMethod objectAllocateMethod, ICoreferenceInfo coreferenceInfo)
        {
            #region [.check input.]
            rdf.ThrowIfNull("rdf");
            if (!rdf.Root.HasElements)
            {
                throw (new ArgumentException("Input linguistics-RDF is empty."));
            }
            #endregion

            #region [.Opinion-mining.]
            if (callPreprocessRdf)
            {
                rdf = Algorithms.PreprocessRdf(rdf);
            }

            var inputParams = new OpinionMiningInputParams("[NEVER MIND]", InputTextFormat.LinguisticXml)
            {
                ObjectAllocateMethod = objectAllocateMethod
            };

            var opinionMiningTuples = ExecuteInternal(rdf, inputParams, coreferenceInfo);
            #endregion

            #region [.result.]
            var opinionMiningOutputResult = new OpinionMiningOutputResult(opinionMiningTuples, RuleBase.GetOperateRulesNamesDebugInfoOutput());
            return(opinionMiningOutputResult);

            #endregion
        }
        public OpinionMiningOutputResult ExecuteOpinionMining(OpinionMiningInputParams inputParams)
        {
            var xdocument = default(XDocument);

            try
            {
                #region [.check input.]
                inputParams.ThrowIfNull("inputParams");
                #endregion

                #region [.Linguistic.]
                var linguisticStopwatch = Stopwatch.StartNew();
                switch (inputParams.InputTextFormat)
                {
                case InputTextFormat.PlainText:
                    xdocument = LinguisticsDecorator.ProcessText(inputParams);
                    break;

                case InputTextFormat.LinguisticXml:
                    xdocument = Algorithms.PreprocessRdf(inputParams.InputText);
                    break;

                default:
                    throw (new ArgumentException(inputParams.InputTextFormat.ToString()));
                }
                linguisticStopwatch.Stop();

                if (!xdocument.Root.HasElements)
                {
                    throw (new ArgumentException("Linguistics returned empty xml."));
                }
                #endregion

                #region [.read coreference-info from Rdf.]
                var coreferenceInfo = _CoreferenceResolver.ReadFromRdf(xdocument.Root);
                #endregion

                #region [.Opinion-mining.]
                var opinionMiningStopwatch = Stopwatch.StartNew();

                var opinionMiningTuples = ExecuteInternal(xdocument, inputParams, coreferenceInfo);

                opinionMiningStopwatch.Stop();
                #endregion

                #region [.write in log.]
                LOG.InfoEx(MethodBase.GetCurrentMethod().Name, WcfHelper.ClientRemoteAddress, linguisticStopwatch.Elapsed, opinionMiningStopwatch.Elapsed, inputParams);
                #endregion

                #region [.result.]
                var opinionMiningOutputResult = new OpinionMiningOutputResult
                                                (
                    opinionMiningTuples,
                    RuleBase.GetOperateRulesNamesDebugInfoOutput()
                                                );

                return(opinionMiningOutputResult);

                #endregion
            }
            catch (Exception ex)
            {
                #region [.write error in log & rethrow.]
                LOG.ErrorEx(MethodBase.GetCurrentMethod().Name, ex, WcfHelper.ClientRemoteAddress, inputParams, xdocument);
                throw;
                #endregion
            }
        }