Exemplo n.º 1
0
        static void Main()
        {
            Console.Write("Enter your Bible verse: ");

            // Add input data
            var    input      = new ModelInput();
            var    bibleVerse = Console.ReadLine();
            string bibleVerseCheck;

            // Check Bible Verse for correct format and valid abbreviations
            var match = Regex.Match(bibleVerse, VersePatterns.bibleVersePattern);

            bibleVerseCheck = match.Success ? "Bible verse is valid" : "Bible verse is invalid";
            Console.Write(bibleVerseCheck);
            if (!match.Success)
            {
                return;
            }

            // Obtain the Bible Version from the user.
            var versionKeys = new BibleVersionKeys();

            Console.Write("\n\nEnter the bible version you are planning to use (ASV, BBE, DARBY, KJV, WBT WEB, YLT): ");
            var bibleVersion = Console.ReadLine();
            BibleVersionInfo?dbVersionInfo = versionKeys.GetVersionInfo(bibleVersion);

            if (dbVersionInfo == null)
            {
                Console.Write("Invalid Bible Version");
                return;
            }

            // Retrieve the bible verse and display it back to the console
            var verseKeys = new BibleVerseKeys();
            BookAbbreviationInfo dbVerseInfo    = verseKeys.GetVerseInfo(bibleVerse);
            VersicleInfo         dbVersicleInfo = BibleVerseKeys.GetVersicleInfo(bibleVerse);

            BibleText bText = new BibleText((BibleVersion)Enum.Parse(typeof(BibleVersion), bibleVersion, true),
                                            dbVerseInfo,
                                            dbVersicleInfo);
            string verseText = bText.GetBibleVerse();

            Console.WriteLine();

            // Perform analysis on the said Bible verse as to sentiment (for now)
            input.SentimentText = verseText;

            // Load model and predict output of sample data
            ModelOutput result = ConsumeModel.Predict(input);

            Console.WriteLine($"Text: {input.SentimentText}\nIs Toxic: {((result.Prediction == "1")?"true":"false")}");
        }
Exemplo n.º 2
0
        public BibleText(BibleVersion version, BookAbbreviationInfo book, VersicleInfo versicle)
        {
            _book     = book;
            _versicle = versicle;
            switch (version)
            {
            case BibleVersion.ASV:   _pathToExcelFile = @"C:\Users\anton\source\repos\myMLApp\myMLApp.Data\CSV\t_asv.csv"; break; // American Standard-ASV1901

            case BibleVersion.BBE:   _pathToExcelFile = @"C:\Users\anton\source\repos\myMLApp\myMLApp.Data\CSV\t_bbe.csv"; break; // Bible in Basic English

            case BibleVersion.DARBY: _pathToExcelFile = @"C:\Users\anton\source\repos\myMLApp\myMLApp.Data\CSV\t_dby.csv"; break; // Darby English Bible

            case BibleVersion.KJV:   _pathToExcelFile = @"C:\Users\anton\source\repos\myMLApp\myMLApp.Data\CSV\t_kjv.csv"; break; // King James Version

            case BibleVersion.WBT:   _pathToExcelFile = @"C:\Users\anton\source\repos\myMLApp\myMLApp.Data\CSV\t_wbt.csv"; break; // Webster's Bible

            case BibleVersion.WEB:   _pathToExcelFile = @"C:\Users\anton\source\repos\myMLApp\myMLApp.Data\CSV\t_web.csv"; break; // World English Bible

            case BibleVersion.YLT:   _pathToExcelFile = @"C:\Users\anton\source\repos\myMLApp\myMLApp.Data\CSV\t_ylt.csv"; break; // Young's Literal Translation

            default: _pathToExcelFile = @"C:\Users\anton\source\repos\myMLApp\myMLApp.Data\CSV\t_asv.csv"; break;                 // By defaul is the American standard version
            }
            _conxObject = new ConnectiontoExcel(_pathToExcelFile);
        }