TestCaseMan.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. namespace App\Console\Commands;
  3. use Illuminate\Console\Command;
  4. use App\Tools\CaseMan;
  5. use App\Models\UserDict;
  6. class TestCaseMan extends Command
  7. {
  8. /**
  9. * The name and signature of the console command.
  10. *
  11. * @var string
  12. */
  13. protected $signature = 'test:case {word}';
  14. /**
  15. * The console command description.
  16. *
  17. * @var string
  18. */
  19. protected $description = 'Command description';
  20. /**
  21. * Create a new command instance.
  22. *
  23. * @return void
  24. */
  25. public function __construct()
  26. {
  27. parent::__construct();
  28. }
  29. /**
  30. * Execute the console command.
  31. *
  32. * @return int
  33. */
  34. public function handle()
  35. {
  36. $caseMan = new CaseMan();
  37. $case = $caseMan->Declension($this->argument('word'),'.n:base.','.nt.',0.5);
  38. print_r($case);
  39. return 0;
  40. $parents = $caseMan->WordToBase($this->argument('word'),1);
  41. # code...
  42. foreach ($parents as $base => $rows) {
  43. # code...
  44. if(count($rows)==0){
  45. $this->error("base={$base}-(".count($rows).")");
  46. }else{
  47. $this->warn("base={$base}-(".count($rows).")");
  48. }
  49. foreach ($rows as $value) {
  50. # code...
  51. $this->info($value['word'].'-'.$value['type'].'-'.$value['grammar'].'-'.$base);
  52. }
  53. }
  54. return 0;
  55. }
  56. }