@@ -814,6 +814,9 @@ function parse_japanese_text($text, $id): ?array
814814 $ count = 0 ;
815815 $ row = array (0 , 0 , 0 , "" , 0 );
816816 foreach (explode (PHP_EOL , $ mecabed ) as $ line ) {
817+ if (trim ($ line ) == "" ) {
818+ continue ;
819+ }
817820 list ($ term , $ node_type , $ third ) = explode (mb_chr (9 ), $ line );
818821 if ($ term_type == 2 || $ term == 'EOP ' && $ third == '7 ' ) {
819822 $ sid += 1 ;
@@ -1048,6 +1051,9 @@ function ($matches) use ($noSentenceEnd) {
10481051 $ count = 0 ;
10491052 $ row = array (0 , 0 , 0 , "" , 0 );
10501053 foreach (explode ("\n" , $ text ) as $ line ) {
1054+ if (trim ($ line ) == "" ) {
1055+ continue ;
1056+ }
10511057 list ($ word_count , $ term ) = explode ("\t" , $ line );
10521058 $ row [0 ] = $ sid ; // TiSeID
10531059 $ row [1 ] = $ count + 1 ; // TiCount
@@ -1901,9 +1907,8 @@ function check_update_db($debug, $tbpref, $dbname): void
19011907 $ queries = SQLParser (__DIR__ . "/../db/schema/baseline.sql " );
19021908 foreach ($ queries as $ query ) {
19031909 $ prefixed_query = prefixSQLQuery ($ query , $ tbpref );
1904- runsql ($ prefixed_query , "" );
1905- // Increment for new tables only
1906- $ count ++;
1910+ // Increment count for new tables only
1911+ $ count += runsql ($ prefixed_query , "" );
19071912 }
19081913
19091914 if (!in_array ("{$ tbpref }textitems2 " , $ tables )) {
@@ -1934,8 +1939,8 @@ function check_update_db($debug, $tbpref, $dbname): void
19341939 runsql (
19351940 "ALTER TABLE ` {$ tbpref }sentences` ADD SeFirstPos smallint(5) NOT NULL " ,
19361941 '' ,
1937- false
1938- );//move to update_database()?
1942+ false
1943+ );
19391944
19401945 if ($ count > 0 ) {
19411946 // Rebuild Text Cache if cache tables new
0 commit comments