NlpWordRequest.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. * TOP API: taobao.nlp.word request
  4. *
  5. * @author auto create
  6. * @since 1.0, 2016.01.12
  7. */
  8. class NlpWordRequest
  9. {
  10. /**
  11. * 文本内容
  12. **/
  13. private $text;
  14. /**
  15. * 功能类型选择:1)wType=1时提供分词功能,type=0时为基本粒度,type=1时为混合粒度,type=3时为基本粒度和混合粒度共同输出;
  16. **/
  17. private $wType;
  18. private $apiParas = array();
  19. public function setText($text)
  20. {
  21. $this->text = $text;
  22. $this->apiParas["text"] = $text;
  23. }
  24. public function getText()
  25. {
  26. return $this->text;
  27. }
  28. public function setwType($wType)
  29. {
  30. $this->wType = $wType;
  31. $this->apiParas["w_type"] = $wType;
  32. }
  33. public function getwType()
  34. {
  35. return $this->wType;
  36. }
  37. public function getApiMethodName()
  38. {
  39. return "taobao.nlp.word";
  40. }
  41. public function getApiParas()
  42. {
  43. return $this->apiParas;
  44. }
  45. public function check()
  46. {
  47. RequestCheckUtil::checkNotNull($this->wType,"wType");
  48. }
  49. public function putOtherTextParam($key, $value) {
  50. $this->apiParas[$key] = $value;
  51. $this->$key = $value;
  52. }
  53. }