Guest User

Untitled

a guest
Jun 22nd, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. hasradical{"map":
  2. function(doc) {
  3. /* only deal with chars, not words */
  4. if (doc.type != 'meng_unihan') {return;}
  5. if (doc.frequency > 3) { return;}
  6. if (doc.strokes === null) {
  7. emit(doc.radical_id, {unicode:doc.codepoint, type:'radical'});
  8. } else {
  9. if (doc.radical_id)
  10. emit(doc.radical_id, {unicode:doc.codepoint, stk:doc.strokes, rstk:doc.strokes_r, radical_id: doc.radical_id, type:'char', pronounce:doc.pronounce});
  11. }
  12. }
  13. },
  14. otherpos {"map":
  15. function(doc) {
  16. /* only deal with words, not chars */
  17. if (doc.type != 'meng_word') {return;}
  18. hex = doc.as_utfhex.split('\\u');
  19. firstPassed = false
  20. for (x in hex) {
  21. if (hex[x].length > 2) {
  22. if (firstPassed)
  23. emit (hex[x], {hex: doc.as_utfhex, raw:doc.as_raw, meaning:doc.meaning});
  24. //only emit other chars
  25. firstPassed = true;
  26. }
  27. }
  28. }
  29. },
  30.  
  31. firstpos {"map":
  32. function(doc) {
  33. /* only deal with words, not chars */
  34. if (doc.type != 'meng_word') {return;}
  35. hex = doc.as_utfhex.split('\\u');
  36. for (x in hex) {
  37. if (hex[x].length > 2) {
  38. emit (hex[x], {hex: doc.as_utfhex, raw:doc.as_raw, meaning:doc.meaning});
  39. //only emit the first char
  40. break;
  41. }
  42. }
  43. }
  44. }
Add Comment
Please, Sign In to add comment