如何使用scala上的当前月份和年份获取第一个日期和最后日期

时间:2016-11-11 06:30:54

标签: scala date playframework

我想在Scala上玩当前月份和年份的第一个日期和最后日期。我正在尝试这个link,但它返回为空 这里提到了代码。我该怎么办?任何人都可以帮助我。

def sampleDate(year: Int,month: Int) = Action {implicit request =>
 println("---------m&y----------",year,month)
 var endOfMonth = Calendar.getInstance();
 println("---------Month----------", endOfMonth.set(Calendar.MONTH,month))
 println("---------Year----------", endOfMonth.set(Calendar.YEAR,year))
 Ok("")
}

输出:

(---------m&y----------,2016,11)
(---------Month----------,())
(---------Year----------,())

1 个答案:

答案 0 :(得分:-1)

你可以这样做:

import nltk

hypothesis = ['This', 'is', 'cat'] 
reference = ['This', 'is', 'a', 'cat']
BLEUscore = nltk.translate.bleu_score.sentence_bleu([reference], hypothesis, weights = [1])
print(BLEUscore)