test.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. require('colors');
  2. var util = require('util')
  3. var game = {
  4. dungeon: require('./dungeon.js'),
  5. monsters: require('./monsters.js'),
  6. weapons: require('./weapons.js'),
  7. items: require('./items.js'),
  8. //weapons: require('./weapons.js'),
  9. }
  10. var parser = require('./parser.js')(game);
  11. parser.processGame();
  12. if(process.argv[2] == "parser") {
  13. var parser_input = [
  14. "izzy attacks with condescension",
  15. "izzy attacks steve",
  16. "izzy attacks parking attendant",
  17. "izzy attacks the parking attendant",
  18. "izzy attacks the first parking attendant",
  19. "izzy attacks the 2nd parking attendant",
  20. "izzy attacks the last parking attendant using condescension",
  21. "izzy attacks steve with condescension",
  22. "izzy gives steve the laptop",
  23. "izzy grabs a few cards",
  24. "izzy looks around ",
  25. "izzy looks around steve",
  26. "izzy looks around the lawn",
  27. "izzy looks around the maintenance shed",
  28. ];
  29. parser_input.map(function(x) {
  30. var y = parser.parse(x)
  31. console.log("\n\n" + x.green + "\n" + util.inspect(y, false, null, true));
  32. });
  33. }
  34. else if(process.argv[2] == "stemmer") {
  35. var stemmer_input = [
  36. 'green',
  37. 'greens',
  38. "green's",
  39. "steve",
  40. "steves",
  41. "steve's",
  42. "steves'",
  43. "free",
  44. "frees",
  45. "free's",
  46. "frees'",
  47. ];
  48. stemmer_input.map(parser.stemmer).map(function(x) {console.log(x)});
  49. }
  50. else if(process.argv[2] == "stripper") {
  51. var stemmer_input = [
  52. '.foo', // strip
  53. 'foo.', // strip
  54. 'foo.net', // don't strip
  55. 'foo?><,\'";:[]{}-=+|\\/*&^%$#@!`~net', // strip
  56. ];
  57. stemmer_input.map(parser.stripper).map(function(x) {console.log(x)});
  58. }