示例#1
0
            public void TestConjugVerb()
            {
                JpString taberuConjug = (JpString) new VerbeDll("たべます", "食べます", "tabemasu", E_TypeVerb.Ichidan);

                Assert.AreEqual(
                    JapaneseTools.ConjugVerb(taberu, E_TmpsVerb.Present, true, false),
                    taberuConjug);
            }
示例#2
0
        static void Main(string[] args)
        {
            Jp_Tools.AdjectifDll adj = new Jp_Tools.AdjectifDll()
            {
                furigana = "おいしい",
                kanji    = "美味しい",
                romaji   = "oishii",
                type     = "I"
            };
            var o = JapaneseTools.ConjugAdjectif(adj, Jp_Tools.JapaneseTools.E_TmpsAdj.Provisional, false, true);

            Console.WriteLine(o);
        }
示例#3
0
            public void TestNumberToKanji()
            {
                Assert.AreEqual(
                    JapaneseTools.NumberToKana(12345, true, false, false),
                    "一万二千三百四十五");

                Assert.AreEqual(
                    JapaneseTools.NumberToKana(849846846, true, false, false),
                    "八億四千九百八十四万六千八百四十六");

                Assert.AreEqual(
                    JapaneseTools.NumberToKana(10003800, true, false, false),
                    "一千万三千八百");
            }
示例#4
0
            public void TestNumberToKana()
            {
                Assert.AreEqual(
                    JapaneseTools.NumberToKana(12345, false, false, false),
                    "いちまんにせんさんびゃくよんじゅうご");

                Assert.AreEqual(
                    JapaneseTools.NumberToKana(849846846, false, false, false),
                    "はちおくよんせんきゅうひゃくはちじゅうよんまんろくせんはっぴゃくよんじゅうろく");

                Assert.AreEqual(
                    JapaneseTools.NumberToKana(10003800, false, false, false),
                    "いっせんまんさんぜんはっぴゃく");
            }
示例#5
0
        public static async Task <List <SongBundle> > GetSearchResults(string query)
        {
            string results = await HttpRequests.GetRequest(GeniusSearchUrl + Uri.EscapeUriString(query), GeniusAuthHeader);

            JObject parsed = JObject.Parse(results);

            IList <JToken> parsedList = parsed["response"]?["hits"]?.Children().ToList();

            List <SongBundle> resultsList = new List <SongBundle>();

            if (parsedList != null && parsedList.Count != 0)
            {
                foreach (JToken result in parsedList)
                {
                    Song song = new Song
                    {
                        Id      = (int)result["result"]?["id"],
                        Title   = (string)result["result"]?["title"],
                        Artist  = (string)result["result"]?["primary_artist"]?["name"],
                        Cover   = (string)result["result"]?["song_art_image_thumbnail_url"],
                        Header  = (string)result["result"]?["header_image_url"],
                        ApiPath = (string)result["result"]?["api_path"],
                        Path    = (string)result["result"]?["path"]
                    };

                    RomanizedSong rSong = new RomanizedSong();
                    if (Prefs.GetBoolean("romanize_search", false))
                    {
                        rSong = await JapaneseTools.RomanizeSong(song, false);
                    }

                    resultsList.Add(new SongBundle(song, rSong));
                }

                return(resultsList);
            }

            resultsList = new List <SongBundle>();
            return(resultsList);
        }
示例#6
0
            public void TestKanjiToNumber()
            {
                Assert.AreEqual(
                    JapaneseTools.KanjiToNumber("一万二千三百四十五"),
                    "12345");

                Assert.AreEqual(
                    JapaneseTools.KanjiToNumber("八億百万二百"),
                    "801000200");

                Assert.AreEqual(
                    JapaneseTools.KanjiToNumber("八億四十万二百"),
                    "800400200");

                Assert.AreEqual(
                    JapaneseTools.KanjiToNumber("八億七千九百三十二万五千八百四十六"),
                    "879325846");


                Assert.AreEqual(
                    JapaneseTools.KanjiToNumber("一千万三千八百"),
                    "10003800");
            }
示例#7
0
        private async Task ShowLyrics()
        {
            Log(Type.Info, "Started ShowLyrics method");

            #region UI Variables
            TextView           infoTxt            = FindViewById <TextView>(Resource.Id.infoTxt);
            ProgressBar        lyricsLoadingWheel = FindViewById <ProgressBar>(Resource.Id.lyricsLoadingWheel);
            SwipeRefreshLayout refreshLayout      = FindViewById <SwipeRefreshLayout>(Resource.Id.swipeRefreshLayout);
            ImageView          savedView          = FindViewById <ImageView>(Resource.Id.savedView);
            ImageButton        fabMore            = FindViewById <ImageButton>(Resource.Id.fabMore);
            #endregion

            string lyrics = await Genius.GetSongLyrics(songInfo);

            songInfo.Normal.Lyrics = lyrics;

            //TODO: Make auto-romanization happen after loading normal version of song
            //Auto-romanize based on preferences
            if (songInfo.Normal.Lyrics.ContainsJapanese() && Prefs.GetBoolean("auto_romanize", false))
            {
                RomanizedSong romanized = await JapaneseTools.RomanizeSong(songInfo.Normal, true);

                //Fill empty info for songs with romanized lyrics and non-romanized details
                if (string.IsNullOrEmpty(romanized.Title) &&
                    !string.IsNullOrEmpty(songInfo.Normal.Title))
                {
                    romanized.Title = songInfo.Normal.Title;
                }
                if (string.IsNullOrEmpty(romanized.Artist) &&
                    !string.IsNullOrEmpty(songInfo.Normal.Artist))
                {
                    romanized.Artist = songInfo.Normal.Artist;
                }
                if (string.IsNullOrEmpty(romanized.Album) &&
                    !string.IsNullOrEmpty(songInfo.Normal.Album))
                {
                    romanized.Album = songInfo.Normal.Album;
                }
                if (string.IsNullOrEmpty(romanized.FeaturedArtist) &&
                    !string.IsNullOrEmpty(songInfo.Normal.FeaturedArtist))
                {
                    romanized.FeaturedArtist = songInfo.Normal.FeaturedArtist;
                }

                songInfo.Romanized        = romanized;
                songInfo.Normal.Romanized = true;
            }
            else
            {
                if (songInfo.Romanized != null)
                {
                    songInfo.Romanized.Lyrics = "";
                }
            }

            UpdateSong(songInfo, false, false);
            RunOnUiThread(() =>
            {
                fabMore.Visibility   = ViewStates.Visible;
                savedView.Visibility = ViewStates.Gone;
                infoTxt.Visibility   = ViewStates.Visible;

                lyricsLoadingWheel.Visibility = ViewStates.Gone;
                refreshLayout.Refreshing      = false;
            });

            shouldCheck = true;

            Log(Type.Info, "Finished getting lyrics from Genius");
            Analytics.TrackEvent("Finished getting lyrics from Genius", new Dictionary <string, string> {
                { "SongID", songInfo.Normal.Id.ToString() }
            });
        }