Пример #1
0
        static public IWordBreaker createBreaker(string lang)
        {
            var  factory   = langToBreakerGuid.TryGetValue(lang, out string guid) ? guidToBreakerFactory[guid] : invariantBreakerFactory;
            var  res       = ComHelper.CreateInstance <IWordBreaker>(factory, typeof(IWordBreaker));
            bool pfLicense = false;

            res.Init(true, 1000, out pfLicense);
            return(res);
        }
Пример #2
0
        static public IStemmer createStemmer(string lang)
        {
            if (!langToStemmerGuid.TryGetValue(lang, out string guid))
            {
                return(null);
            }
            var  res       = ComHelper.CreateInstance <IStemmer>(guidToStemmerFactory[guid], typeof(IStemmer));
            bool pfLicense = false;

            res.Init(1000, out pfLicense);
            return(res);
        }
Пример #3
0
        static IClassFactory getClassFactory(string classInfo, Dictionary <string, LibraryModule> modules)
        {
            var parts = classInfo.Split('/');
            var fn    = parts[1];

            lock (modules) {
                if (!modules.TryGetValue(fn, out LibraryModule module))
                {
                    modules.Add(fn, module = LibraryModule.LoadModule(Root.root + fn));
                }
                var guid = new Guid(parts[0]);
                return(ComHelper.GetClassFactory(modules[fn], guid));
            }
        }