我知道我们可以检查如下资源:
function runIncreaseCountTransaction(referralCodesDocRef){
return db.runTransaction(t => {
return t.get(referralCodesDocRef)
.then(doc => {
console.log(doc);
let newReferralCount = doc.data().referral_count + 1;
if (newReferralCount === max_referral_count) {
const current_time_millis = Date.now();
const end_time_millis = current_time_millis+(180*1000); // ends after 3 mins
return t.update(referralCodesDocRef,
{
referral_count: newReferralCount,
timer_start_time: current_time_millis,
timer_end_time: end_time_millis
});
} else{
return t.update(referralCodesDocRef, { referral_count: newReferralCount });
}
});
})
.then(result => {
console.log('Success: Update successful: Referral count incremented!!', result);
return null;
})
.catch(err => {
console.log('Error: could not update referral count', err);
return null; //Note the return here.
});
}
但是我找不到为wordnet做到这一点的方法:
try:
nltk.data.find('tokenizers/punkt')
except LookupError:
nltk.download('punkt')
如何进行此项检查?
答案 0 :(得分:0)
您可以这样做:
nltk.find('corpora/wordnet')