testnlp.go 790 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package main
  2. import (
  3. "strings"
  4. "git.wecise.com/wecise/common/modb"
  5. "git.wecise.com/wecise/common/nlp"
  6. "gitee.com/wecisecode/util/logger"
  7. )
  8. /*
  9. ??{Author}?????
  10. ????{File}???
  11. ????{Tags}??
  12. ??,????{Tags}???
  13. ???{Tags}???"
  14. ???????{Time}??,??{Tags}???
  15. ??{Author}???,??{Tags}??
  16. */
  17. func main() {
  18. samples := `??{Author}?????
  19. ????{File}???
  20. ????{Tags}??
  21. ??,????{Tags}???
  22. ???{Tags}???"
  23. ???????{Time}??,??{Tags}???
  24. ??{Author}???,??{Tags}??`
  25. if client, err := modb.New("hdim"); err == nil {
  26. if robot, err := nlp.NLPNew(client, "kdb", strings.Split(samples, "\n")); err == nil {
  27. if data, _, err := robot.Answer("kdb", "next"); err != nil {
  28. logger.Error(err)
  29. } else {
  30. logger.Info("data =>", data)
  31. }
  32. } else {
  33. logger.Error(err)
  34. }
  35. } else {
  36. logger.Error(err)
  37. }
  38. }