Last active
August 29, 2015 14:09
-
-
Save yuzu441/91acfc7b2479f628c91d to your computer and use it in GitHub Desktop.
ことえり dictionary to GoogleIME dictionary
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if($argc != 3) { | |
exit("引数の数が正しくありません".PHP_EOL | |
."サンプル".PHP_EOL | |
."php parse.php 辞書データファイル名 出力先ファイル名".PHP_EOL); | |
} | |
$xml = simplexml_load_file($argv[1]); | |
$outputData = ""; | |
foreach($xml->array->dict as $item) { | |
$line = $item->string[1]."\t" | |
.$item->string[0]."\t" | |
."名詞".PHP_EOL; | |
$outputData = $outputData.$line; | |
} | |
file_put_contents("output.txt", $outputData, LOCK_EX); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment