Github user takuti commented on a diff in the pull request: https://github.com/apache/incubator-hivemall/pull/97#discussion_r126846757 --- Diff: nlp/src/main/java/hivemall/nlp/tokenizer/KuromojiUDF.java --- @@ -170,6 +192,100 @@ private static CharArraySet stopWords(@Nonnull final String[] array) return results; } + @Nullable + private static UserDictionary userDictionary(@Nonnull final ObjectInspector oi) + throws UDFArgumentException { + if (HiveUtils.isConstListOI(oi)) { + return userDictionary(HiveUtils.getConstStringArray(oi)); + } else if (HiveUtils.isConstString(oi)) { + return userDictionary(HiveUtils.getConstString(oi)); + } else { + throw new UDFArgumentException( + "User dictionary MUST be given as an array of constant string or constant string (URL)"); + } + } + + @Nullable + private static UserDictionary userDictionary(@Nullable final String[] userDictArray) + throws UDFArgumentException { + if (userDictArray == null) { + return null; + } + + StringBuilder builder = new StringBuilder(); + for (String row : userDictArray) { + builder.append(row); + builder.append("\r\n"); --- End diff -- Not necessarily. It's just CRLF.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---