其實(shí)前廳接待員說(shuō)起來(lái)是沒(méi)什么技術(shù)含量的,首先氣質(zhì)要好,面試的時(shí)候最好穿著整潔干凈,不宜濃妝,面試前先對(duì)前廳接待員的工作內(nèi)容有個(gè)大概的了解。其實(shí)我也沒(méi)有面試過(guò),瞎答的,僅供參考。
前臺(tái)接待的英文:Corporate receptionist
receptionist 讀法 英 [r?'sep?(?)n?st] 美 [r?'s?p??n?st]
n(名詞). 接待員;傳達(dá)員;前臺(tái)接待
短語(yǔ)
1、Spa Receptionist 水療接待員
2、Medical Receptionist 醫(yī)療接待師
3、Receptionist Position 售后接待
4、Night Receptionist 前臺(tái)接待夜班
5、Digital Receptionist 語(yǔ)音服務(wù)
擴(kuò)展資料
Receptionist 近義詞 secretary
詞語(yǔ)用法
1、secretary的基本意思是“秘書(shū)”,也可作“書(shū)記”“部長(zhǎng),大臣”解,是可數(shù)名詞。當(dāng)secretary表示唯一職務(wù)時(shí),其前不加定冠詞。
2、secretary作“部長(zhǎng),大臣”解時(shí),首字母大寫(xiě)。
3、secretary常和介詞to或of連用,表示“的秘書(shū)”。接人時(shí)常用to,接物時(shí)常用of。
4、secretary作名詞,特指某一職位時(shí),前面不加冠詞a,后跟介詞to,
詞匯搭配
1、employ a new secretary 雇用新秘書(shū)
2、train a secretary 培訓(xùn)秘書(shū)
3、capable secretary 精明能干的秘書(shū)
4、chief secretary 秘書(shū)長(zhǎng)
5、Foreign secretary 外交部長(zhǎng)
在每個(gè)組織中,接待員扮演著至關(guān)重要的角色。他們是公司的門(mén)面,負(fù)責(zé)接待來(lái)訪者并為其提供必要的幫助和指導(dǎo)。接待員工作職責(zé)涵蓋了廣泛的任務(wù)范圍,要求他們具備出色的溝通和組織能力。
作為一名接待員,您將成為公司的第一印象代表。您的工作之一是熱情地迎接和接待來(lái)訪者,無(wú)論是客戶(hù)、合作伙伴還是潛在的雇員。您需要給予他們良好的印象,并確保他們感受到您的專(zhuān)業(yè)和友善。這意味著您需要提供正確的信息并解答他們的問(wèn)題。
作為接待員,您將成為公司內(nèi)部和外部溝通的紐帶之一。您將負(fù)責(zé)接聽(tīng)和轉(zhuǎn)接電話,記錄留言并回復(fù)電子郵件。因此,出色的電話禮儀和書(shū)面溝通能力對(duì)于履行接待員工作職責(zé)非常重要。您需要在通話中保持禮貌和專(zhuān)業(yè),以提供卓越的客戶(hù)服務(wù)。
大堂是公司的前廳,作為接待員,您需要確保大堂的秩序良好。這意味著您需要保持大堂整潔、有序,并確保工作場(chǎng)所的安全。您還需要處理來(lái)訪者的登記和訪客憑證,并向他們提供所需的信息。維護(hù)大堂的專(zhuān)業(yè)形象是您的職責(zé)之一。
與公司內(nèi)部員工和外部客戶(hù)進(jìn)行會(huì)議安排也是接待員的職責(zé)之一。您需要使用日歷管理軟件,安排和協(xié)調(diào)會(huì)議時(shí)間、地點(diǎn)和與會(huì)人員。此外,您還可能需要安排公司內(nèi)部的活動(dòng)和慶祝活動(dòng)。
在忙碌的辦公環(huán)境中,接待員經(jīng)常被要求提供各種支持和協(xié)助。這可能包括打印和復(fù)印文件,準(zhǔn)備會(huì)議材料,以及協(xié)助其他團(tuán)隊(duì)成員解決辦公室問(wèn)題。您應(yīng)該具備良好的組織技巧和多任務(wù)處理能力,以便有效地協(xié)助辦公室管理。
作為接待員,您將接觸到公司的機(jī)密信息和敏感數(shù)據(jù)。因此,保護(hù)公司和客戶(hù)的隱私至關(guān)重要。您需要遵守保密規(guī)定,并采取適當(dāng)?shù)拇胧┍Wo(hù)數(shù)據(jù)的安全。保持信息的機(jī)密性對(duì)于您的職責(zé)和公司的聲譽(yù)都非常重要。
作為公司團(tuán)隊(duì)的一部分,接待員需要與其他部門(mén)密切合作。您可能需要與人力資源、行政和銷(xiāo)售團(tuán)隊(duì)協(xié)調(diào)工作。因此,與團(tuán)隊(duì)合作和良好的人際關(guān)系能力對(duì)于成功履行接待員工作職責(zé)非常重要。
總之,作為接待員,您的工作職責(zé)涵蓋了接待來(lái)訪者、管理電話和郵件、維護(hù)大堂秩序、安排會(huì)議和活動(dòng)、協(xié)助辦公室管理、保護(hù)機(jī)密信息以及與團(tuán)隊(duì)合作。這些任務(wù)要求您具備出色的溝通、組織和協(xié)調(diào)能力,以及保持專(zhuān)業(yè)形象的能力。通過(guò)高效地履行這些職責(zé),您將成為公司的重要支柱,為公司和來(lái)訪者提供優(yōu)質(zhì)的服務(wù)。
商務(wù)接待員:英文全名 "Business receptionist"。主要負(fù)責(zé)公司的各項(xiàng)商務(wù)日常接待,要求:形象好氣質(zhì)佳,普通話標(biāo)準(zhǔn),接受過(guò)專(zhuān)門(mén)的禮儀培訓(xùn),會(huì)英語(yǔ)者優(yōu)先。 "Business receptionist"
商務(wù)接待禮儀:
1.接待人員要品貌端正,舉止大方,口齒清楚,具有一定的文化素養(yǎng),受過(guò)專(zhuān)門(mén)的禮儀、形體、語(yǔ)言、服飾等方面的訓(xùn)練。
2.接待人員服飾要整潔、端莊、得體、高雅;女性應(yīng)避免佩戴過(guò)于夸張或有礙工作的飾物,化妝應(yīng)盡量淡雅。
3.如果來(lái)訪者是預(yù)先約定好的重要客人,則應(yīng)根據(jù)來(lái)訪者的地位、身份等確定相應(yīng)的接待規(guī)格和程序。在辦公室接待一般的來(lái)訪者,談話時(shí)應(yīng)注意少說(shuō)多聽(tīng),最好不要隔著辦公桌與來(lái)人說(shuō)話。對(duì)來(lái)訪者反映的問(wèn)題,應(yīng)作簡(jiǎn)短的記錄。
接待專(zhuān)員崗位職責(zé): 1.服從前臺(tái)接待主管的領(lǐng)導(dǎo),按規(guī)定的程序與標(biāo)準(zhǔn)向客人提供一流的接待服務(wù) 2.負(fù)責(zé)訪客、來(lái)賓的登記、接待、引見(jiàn),對(duì)無(wú)關(guān)人員應(yīng)阻擋在外或協(xié)助保安處理 3.熟練掌握公司概況,能夠回答客人提出的一般性問(wèn)題,提供常規(guī)的非保密信息 4.負(fù)責(zé)電話、郵件、信函的收轉(zhuǎn)發(fā)工作,做好工作信息的記錄、整理、建檔 5.負(fù)責(zé)公司文件、通知的分發(fā),做好分發(fā)記錄并保存 6.配合接待主管完成部分文件的打印、復(fù)印、文字工作 7.負(fù)責(zé)管理前臺(tái)辦公用品及辦公設(shè)備的清潔保養(yǎng) 8.維護(hù)前臺(tái)區(qū)域內(nèi)的整潔,進(jìn)行該區(qū)域內(nèi)的報(bào)刊雜志、盆景植物的日常維護(hù)和保養(yǎng) 9.執(zhí)行公司考勤制度,負(fù)責(zé)員工的考勤記錄匯總、外出登記,監(jiān)督員工刷卡 10.負(fù)責(zé)員工出差預(yù)訂機(jī)票、火車(chē)票、客房等,差旅人員行程及聯(lián)絡(luò)登記 11.對(duì)工作中出現(xiàn)的各種問(wèn)題及時(shí)匯報(bào),提出工作改進(jìn)意見(jiàn) 12.完成領(lǐng)導(dǎo)交辦的其他或臨時(shí)工作
1、遵守規(guī)章制度:嚴(yán)格遵守公司的各項(xiàng)規(guī)章制度,服從主管的工作安排,認(rèn)真完成各項(xiàng)工作任務(wù);
2、制定接待方案:負(fù)責(zé)重要來(lái)訪人員接待方案制定及實(shí)施,全程跟進(jìn)協(xié)調(diào);
3、接待客戶(hù)來(lái)訪:負(fù)責(zé)客戶(hù)的來(lái)訪、資料收集、信息存檔等工作,提供咨詢(xún)服務(wù);
4、做好配套服務(wù):做好接機(jī)送機(jī)行程安排、差旅住宿、餐飲后勤保障等配套服務(wù);
5、組織準(zhǔn)備會(huì)務(wù):負(fù)責(zé)商務(wù)、會(huì)務(wù)、政務(wù)及大型活動(dòng)的組織準(zhǔn)備工作,確保服務(wù)質(zhì)量;
6、管理會(huì)務(wù)活動(dòng):檢查所有接待人員的儀容、儀表,為客戶(hù)提供迎賓和指引服務(wù),監(jiān)管崗位區(qū)域的衛(wèi)生狀況,檢查消防安全,提供茶飲服務(wù),負(fù)責(zé)設(shè)備維修保養(yǎng)的監(jiān)督,做好交接管理;
7、做好應(yīng)急管理:及時(shí)匯報(bào)處理來(lái)賓遇到的困難和要求,做好應(yīng)急管理工作;
8、參加培訓(xùn)與考核:參加針對(duì)接待人員組織的服務(wù)技能培訓(xùn)與考核,提高自身業(yè)務(wù)能力;
消防接待員崗位職責(zé)一是24小時(shí)受理群眾的報(bào)警、求助、咨詢(xún);做好110報(bào)警電話的接聽(tīng)、錄入、報(bào)告幾相關(guān)的信息傳遞、查詢(xún)等工作;二是嚴(yán)格遵守各項(xiàng)工作紀(jì)律和規(guī)章制度,保守警務(wù)機(jī)密,熟練掌握110接警系統(tǒng)的操作,熟悉公安機(jī)關(guān)、社會(huì)職責(zé)部門(mén)的職能和作用;三是接聽(tīng)110報(bào)警電話中,按要素進(jìn)行詢(xún)問(wèn)和文字錄入。受理警情時(shí)應(yīng)語(yǔ)言簡(jiǎn)潔、規(guī)范。接聽(tīng)非警情求助時(shí),要做好解釋工作,并提供必要的幫助;四是對(duì)需要處置的警情,做到“接聽(tīng)、詢(xún)問(wèn)、文字錄入”三同步,。
就是負(fù)責(zé)餐廳區(qū)域服務(wù)、賓客接待等人員。
其崗位職責(zé)是:1、接聽(tīng)顧客的咨詢(xún)、投訴電話,做好記錄的反饋;2、為顧客提供滿(mǎn)意的服務(wù),包括禮品包裝、開(kāi)發(fā)票、辦理VIP卡、發(fā)放報(bào)紙、禮券等;3、負(fù)責(zé)商場(chǎng)的環(huán)境衛(wèi)生的檢查維護(hù),做好分承包方的管理;4、熟練掌握商場(chǎng)的促銷(xiāo)信息,為顧客做好導(dǎo)購(gòu)咨詢(xún)服務(wù)。
專(zhuān)門(mén)負(fù)責(zé)接待的人員叫接待員。
接待員是指于門(mén)前接待的人員,以前又稱(chēng)為知客,例如于寺廟接待信眾的僧人稱(chēng)為知客僧。知客一詞現(xiàn)時(shí)仍常見(jiàn)于香港及澳門(mén),在中國(guó)大陸的一些大城市也可見(jiàn)到。
接待員也可能指企業(yè)詢(xún)問(wèn)處的職員,行政部門(mén)的第一線服務(wù)員,他們負(fù)責(zé)接待訪客,了解其來(lái)意,并有效分流到其他部門(mén),進(jìn)一步給來(lái)賓深度服務(wù)。
之前看了Mahout官方示例 20news 的調(diào)用實(shí)現(xiàn);于是想根據(jù)示例的流程實(shí)現(xiàn)其他例子。網(wǎng)上看到了一個(gè)關(guān)于天氣適不適合打羽毛球的例子。
訓(xùn)練數(shù)據(jù):
Day Outlook Temperature Humidity Wind PlayTennis
D1 Sunny Hot High Weak No
D2 Sunny Hot High Strong No
D3 Overcast Hot High Weak Yes
D4 Rain Mild High Weak Yes
D5 Rain Cool Normal Weak Yes
D6 Rain Cool Normal Strong No
D7 Overcast Cool Normal Strong Yes
D8 Sunny Mild High Weak No
D9 Sunny Cool Normal Weak Yes
D10 Rain Mild Normal Weak Yes
D11 Sunny Mild Normal Strong Yes
D12 Overcast Mild High Strong Yes
D13 Overcast Hot Normal Weak Yes
D14 Rain Mild High Strong No
檢測(cè)數(shù)據(jù):
sunny,hot,high,weak
結(jié)果:
Yes=》 0.007039
No=》 0.027418
于是使用Java代碼調(diào)用Mahout的工具類(lèi)實(shí)現(xiàn)分類(lèi)。
基本思想:
1. 構(gòu)造分類(lèi)數(shù)據(jù)。
2. 使用Mahout工具類(lèi)進(jìn)行訓(xùn)練,得到訓(xùn)練模型。
3。將要檢測(cè)數(shù)據(jù)轉(zhuǎn)換成vector數(shù)據(jù)。
4. 分類(lèi)器對(duì)vector數(shù)據(jù)進(jìn)行分類(lèi)。
接下來(lái)貼下我的代碼實(shí)現(xiàn)=》
1. 構(gòu)造分類(lèi)數(shù)據(jù):
在hdfs主要?jiǎng)?chuàng)建一個(gè)文件夾路徑 /zhoujainfeng/playtennis/input 并將分類(lèi)文件夾 no 和 yes 的數(shù)據(jù)傳到hdfs上面。
數(shù)據(jù)文件格式,如D1文件內(nèi)容: Sunny Hot High Weak
2. 使用Mahout工具類(lèi)進(jìn)行訓(xùn)練,得到訓(xùn)練模型。
3。將要檢測(cè)數(shù)據(jù)轉(zhuǎn)換成vector數(shù)據(jù)。
4. 分類(lèi)器對(duì)vector數(shù)據(jù)進(jìn)行分類(lèi)。
這三步,代碼我就一次全貼出來(lái);主要是兩個(gè)類(lèi) PlayTennis1 和 BayesCheckData = =》
package myTesting.bayes;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.util.ToolRunner;
import org.apache.mahout.classifier.naivebayes.training.TrainNaiveBayesJob;
import org.apache.mahout.text.SequenceFilesFromDirectory;
import org.apache.mahout.vectorizer.SparseVectorsFromSequenceFiles;
public class PlayTennis1 {
private static final String WORK_DIR = "hdfs://192.168.9.72:9000/zhoujianfeng/playtennis";
/*
* 測(cè)試代碼
*/
public static void main(String[] args) {
//將訓(xùn)練數(shù)據(jù)轉(zhuǎn)換成 vector數(shù)據(jù)
makeTrainVector();
//產(chǎn)生訓(xùn)練模型
makeModel(false);
//測(cè)試檢測(cè)數(shù)據(jù)
BayesCheckData.printResult();
}
public static void makeCheckVector(){
//將測(cè)試數(shù)據(jù)轉(zhuǎn)換成序列化文件
try {
Configuration conf = new Configuration();
conf.addResource(new Path("/usr/local/hadoop/conf/core-site.xml"));
String input = WORK_DIR+Path.SEPARATOR+"testinput";
String output = WORK_DIR+Path.SEPARATOR+"tennis-test-seq";
Path in = new Path(input);
Path out = new Path(output);
FileSystem fs = FileSystem.get(conf);
if(fs.exists(in)){
if(fs.exists(out)){
//boolean參數(shù)是,是否遞歸刪除的意思
fs.delete(out, true);
}
SequenceFilesFromDirectory sffd = new SequenceFilesFromDirectory();
String[] params = new String[]{"-i",input,"-o",output,"-ow"};
ToolRunner.run(sffd, params);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println("文件序列化失敗!");
System.exit(1);
}
//將序列化文件轉(zhuǎn)換成向量文件
try {
Configuration conf = new Configuration();
conf.addResource(new Path("/usr/local/hadoop/conf/core-site.xml"));
String input = WORK_DIR+Path.SEPARATOR+"tennis-test-seq";
String output = WORK_DIR+Path.SEPARATOR+"tennis-test-vectors";
Path in = new Path(input);
Path out = new Path(output);
FileSystem fs = FileSystem.get(conf);
if(fs.exists(in)){
if(fs.exists(out)){
//boolean參數(shù)是,是否遞歸刪除的意思
fs.delete(out, true);
}
SparseVectorsFromSequenceFiles svfsf = new SparseVectorsFromSequenceFiles();
String[] params = new String[]{"-i",input,"-o",output,"-lnorm","-nv","-wt","tfidf"};
ToolRunner.run(svfsf, params);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println("序列化文件轉(zhuǎn)換成向量失敗!");
System.out.println(2);
}
}
public static void makeTrainVector(){
//將測(cè)試數(shù)據(jù)轉(zhuǎn)換成序列化文件
try {
Configuration conf = new Configuration();
conf.addResource(new Path("/usr/local/hadoop/conf/core-site.xml"));
String input = WORK_DIR+Path.SEPARATOR+"input";
String output = WORK_DIR+Path.SEPARATOR+"tennis-seq";
Path in = new Path(input);
Path out = new Path(output);
FileSystem fs = FileSystem.get(conf);
if(fs.exists(in)){
if(fs.exists(out)){
//boolean參數(shù)是,是否遞歸刪除的意思
fs.delete(out, true);
}
SequenceFilesFromDirectory sffd = new SequenceFilesFromDirectory();
String[] params = new String[]{"-i",input,"-o",output,"-ow"};
ToolRunner.run(sffd, params);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println("文件序列化失敗!");
System.exit(1);
}
//將序列化文件轉(zhuǎn)換成向量文件
try {
Configuration conf = new Configuration();
conf.addResource(new Path("/usr/local/hadoop/conf/core-site.xml"));
String input = WORK_DIR+Path.SEPARATOR+"tennis-seq";
String output = WORK_DIR+Path.SEPARATOR+"tennis-vectors";
Path in = new Path(input);
Path out = new Path(output);
FileSystem fs = FileSystem.get(conf);
if(fs.exists(in)){
if(fs.exists(out)){
//boolean參數(shù)是,是否遞歸刪除的意思
fs.delete(out, true);
}
SparseVectorsFromSequenceFiles svfsf = new SparseVectorsFromSequenceFiles();
String[] params = new String[]{"-i",input,"-o",output,"-lnorm","-nv","-wt","tfidf"};
ToolRunner.run(svfsf, params);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println("序列化文件轉(zhuǎn)換成向量失敗!");
System.out.println(2);
}
}
public static void makeModel(boolean completelyNB){
try {
Configuration conf = new Configuration();
conf.addResource(new Path("/usr/local/hadoop/conf/core-site.xml"));
String input = WORK_DIR+Path.SEPARATOR+"tennis-vectors"+Path.SEPARATOR+"tfidf-vectors";
String model = WORK_DIR+Path.SEPARATOR+"model";
String labelindex = WORK_DIR+Path.SEPARATOR+"labelindex";
Path in = new Path(input);
Path out = new Path(model);
Path label = new Path(labelindex);
FileSystem fs = FileSystem.get(conf);
if(fs.exists(in)){
if(fs.exists(out)){
//boolean參數(shù)是,是否遞歸刪除的意思
fs.delete(out, true);
}
if(fs.exists(label)){
//boolean參數(shù)是,是否遞歸刪除的意思
fs.delete(label, true);
}
TrainNaiveBayesJob tnbj = new TrainNaiveBayesJob();
String[] params =null;
if(completelyNB){
params = new String[]{"-i",input,"-el","-o",model,"-li",labelindex,"-ow","-c"};
}else{
params = new String[]{"-i",input,"-el","-o",model,"-li",labelindex,"-ow"};
}
ToolRunner.run(tnbj, params);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println("生成訓(xùn)練模型失敗!");
System.exit(3);
}
}
}
package myTesting.bayes;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.PathFilter;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.mahout.classifier.naivebayes.BayesUtils;
import org.apache.mahout.classifier.naivebayes.NaiveBayesModel;
import org.apache.mahout.classifier.naivebayes.StandardNaiveBayesClassifier;
import org.apache.mahout.common.Pair;
import org.apache.mahout.common.iterator.sequencefile.PathType;
import org.apache.mahout.common.iterator.sequencefile.SequenceFileDirIterable;
import org.apache.mahout.math.RandomAccessSparseVector;
import org.apache.mahout.math.Vector;
import org.apache.mahout.math.Vector.Element;
import org.apache.mahout.vectorizer.TFIDF;
import com.google.common.collect.ConcurrentHashMultiset;
import com.google.common.collect.Multiset;
public class BayesCheckData {
private static StandardNaiveBayesClassifier classifier;
private static Map<String, Integer> dictionary;
private static Map<Integer, Long> documentFrequency;
private static Map<Integer, String> labelIndex;
public void init(Configuration conf){
try {
String modelPath = "/zhoujianfeng/playtennis/model";
String dictionaryPath = "/zhoujianfeng/playtennis/tennis-vectors/dictionary.file-0";
String documentFrequencyPath = "/zhoujianfeng/playtennis/tennis-vectors/df-count";
String labelIndexPath = "/zhoujianfeng/playtennis/labelindex";
dictionary = readDictionnary(conf, new Path(dictionaryPath));
documentFrequency = readDocumentFrequency(conf, new Path(documentFrequencyPath));
labelIndex = BayesUtils.readLabelIndex(conf, new Path(labelIndexPath));
NaiveBayesModel model = NaiveBayesModel.materialize(new Path(modelPath), conf);
classifier = new StandardNaiveBayesClassifier(model);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println("檢測(cè)數(shù)據(jù)構(gòu)造成vectors初始化時(shí)報(bào)錯(cuò)。。。。");
System.exit(4);
}
}
/**
* 加載字典文件,Key: TermValue; Value:TermID
* @param conf
* @param dictionnaryDir
* @return
*/
private static Map<String, Integer> readDictionnary(Configuration conf, Path dictionnaryDir) {
Map<String, Integer> dictionnary = new HashMap<String, Integer>();
PathFilter filter = new PathFilter() {
@Override
public boolean accept(Path path) {
String name = path.getName();
return name.startsWith("dictionary.file");
}
};
for (Pair<Text, IntWritable> pair : new SequenceFileDirIterable<Text, IntWritable>(dictionnaryDir, PathType.LIST, filter, conf)) {
dictionnary.put(pair.getFirst().toString(), pair.getSecond().get());
}
return dictionnary;
}
/**
* 加載df-count目錄下TermDoc頻率文件,Key: TermID; Value:DocFreq
* @param conf
* @param dictionnaryDir
* @return
*/
private static Map<Integer, Long> readDocumentFrequency(Configuration conf, Path documentFrequencyDir) {
Map<Integer, Long> documentFrequency = new HashMap<Integer, Long>();
PathFilter filter = new PathFilter() {
@Override
public boolean accept(Path path) {
return path.getName().startsWith("part-r");
}
};
for (Pair<IntWritable, LongWritable> pair : new SequenceFileDirIterable<IntWritable, LongWritable>(documentFrequencyDir, PathType.LIST, filter, conf)) {
documentFrequency.put(pair.getFirst().get(), pair.getSecond().get());
}
return documentFrequency;
}
public static String getCheckResult(){
Configuration conf = new Configuration();
conf.addResource(new Path("/usr/local/hadoop/conf/core-site.xml"));
String classify = "NaN";
BayesCheckData cdv = new BayesCheckData();
cdv.init(conf);
System.out.println("init done...............");
Vector vector = new RandomAccessSparseVector(10000);
TFIDF tfidf = new TFIDF();
//sunny,hot,high,weak
Multiset<String> words = ConcurrentHashMultiset.create();
words.add("sunny",1);
words.add("hot",1);
words.add("high",1);
words.add("weak",1);
int documentCount = documentFrequency.get(-1).intValue(); // key=-1時(shí)表示總文檔數(shù)
for (Multiset.Entry<String> entry : words.entrySet()) {
String word = entry.getElement();
int count = entry.getCount();
Integer wordId = dictionary.get(word); // 需要從dictionary.file-0文件(tf-vector)下得到wordID,
if (StringUtils.isEmpty(wordId.toString())){
continue;
}
if (documentFrequency.get(wordId) == null){
continue;
}
Long freq = documentFrequency.get(wordId);
double tfIdfValue = tfidf.calculate(count, freq.intValue(), 1, documentCount);
vector.setQuick(wordId, tfIdfValue);
}
// 利用貝葉斯算法開(kāi)始分類(lèi),并提取得分最好的分類(lèi)label
Vector resultVector = classifier.classifyFull(vector);
double bestScore = -Double.MAX_VALUE;
int bestCategoryId = -1;
for(Element element: resultVector.all()) {
int categoryId = element.index();
double score = element.get();
System.out.println("categoryId:"+categoryId+" score:"+score);
if (score > bestScore) {
bestScore = score;
bestCategoryId = categoryId;
}
}
classify = labelIndex.get(bestCategoryId)+"(categoryId="+bestCategoryId+")";
return classify;
}
public static void printResult(){
System.out.println("檢測(cè)所屬類(lèi)別是:"+getCheckResult());
}
}