Merge branch 'master' of https://git.trustie.net/gcm3651/ossean
This commit is contained in:
commit
87aee17316
|
|
@ -48,7 +48,7 @@ public class GetSynonyms{
|
|||
@Resource
|
||||
private PlatformProjectDao paltformDao;
|
||||
|
||||
private static String gatherProjectsTableName =TableName.gatherProjectsTableName;//TableName.gatherProjectsTableName;
|
||||
private static String gatherProjectsTableName =TableName.gatherProjectsTableName;
|
||||
private static String synonymsTableName = TableName.synonymsTableName;
|
||||
private static String pointerTableName = TableName.pointerTableName;
|
||||
private static int batchSize = 1000;
|
||||
|
|
@ -89,6 +89,7 @@ public class GetSynonyms{
|
|||
{
|
||||
//当多个项目具有相同别名的时候,选出最适合的那个项目,并将其余项目的该别名所对应的flag置0
|
||||
synonymMap = synonymsFilter(synonymMap,synonymsTableName,model);
|
||||
//System.out.println("dealing with project:" + model.getId());
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
|
|
@ -251,8 +252,8 @@ public class GetSynonyms{
|
|||
}
|
||||
if(communityValue1 == 1)
|
||||
{
|
||||
List<Integer> hot1 = paltformDao.getHotValue("github_tmp","forks",model1.getUrl_md5());
|
||||
List<Integer> hot2 = paltformDao.getHotValue("github_tmp","forks",model2.getUrl_md5());
|
||||
List<Integer> hot1 = paltformDao.getHotValue("github","forks",model1.getUrl_md5());
|
||||
List<Integer> hot2 = paltformDao.getHotValue("github","forks",model2.getUrl_md5());
|
||||
if(hot1.size()>0 && hot2.size()>0)
|
||||
return hot1.get(0) > hot2.get(0) ? model1:model2;
|
||||
else
|
||||
|
|
@ -267,8 +268,8 @@ public class GetSynonyms{
|
|||
//freecode项目抽取结果中只有创建时间可以利用,创建时间较早的认为比较可信
|
||||
DateFormat df1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
DateFormat df2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
List<String> time1 = paltformDao.getTime("gather_projects", "extracted_time", model1.getUrl_md5());
|
||||
List<String> time2 = paltformDao.getTime("gather_projects", "extracted_time",model2.getUrl_md5());
|
||||
List<String> time1 = paltformDao.getTime("freecode_project ", "extracted_time", model1.getUrl_md5());
|
||||
List<String> time2 = paltformDao.getTime("freecode_project ", "extracted_time",model2.getUrl_md5());
|
||||
if(time1!=null && time2!=null)
|
||||
try {
|
||||
Date dt1 = df1.parse(time1.get(0));
|
||||
|
|
@ -372,7 +373,7 @@ public class GetSynonyms{
|
|||
{
|
||||
//github项目名称中有斜杠,提取斜杠后内容做为别名
|
||||
String subName = getSubName(prjName);
|
||||
if(subName != null)
|
||||
if(subName != null && !subName.equals(""))
|
||||
{
|
||||
SynonymMap.put(subName, 1);
|
||||
}
|
||||
|
|
@ -708,12 +709,14 @@ public class GetSynonyms{
|
|||
{
|
||||
for(String name:linkNameResult){
|
||||
//be动词前不包括项目类型,且和项目名不相同
|
||||
|
||||
if(!keywords.contains(name.toLowerCase().trim()) && !name.toLowerCase().trim().equals(model.getName().toLowerCase().trim())
|
||||
&& !name.toLowerCase().trim().equals(projectNameWithoutComName.toLowerCase().trim())){
|
||||
//这里的prjName是完整的name
|
||||
if(model.getName().toLowerCase().indexOf(name.toLowerCase()) != -1){
|
||||
String withoutShortDash = RemoveShortDash(name);
|
||||
if(name.toLowerCase().equals(bracket.toLowerCase()) || name.toLowerCase().equals(withoutShortDash))
|
||||
if((bracket != null && !bracket.equals("")) && (name.toLowerCase().equals(bracket.toLowerCase()) || name.toLowerCase().equals(withoutShortDash))
|
||||
)
|
||||
synonymsList.add(name);
|
||||
else
|
||||
{
|
||||
|
|
@ -743,10 +746,13 @@ public class GetSynonyms{
|
|||
private String getSubName(String prjName) {
|
||||
// TODO Auto-generated method stub
|
||||
String SubName = prjName;
|
||||
if(prjName.indexOf('/') == -1)
|
||||
return SubName;
|
||||
else
|
||||
SubName = prjName.substring(prjName.indexOf('/') + 1);
|
||||
if(!prjName.equals(""))
|
||||
{
|
||||
if(prjName.indexOf('/') == -1)
|
||||
return SubName;
|
||||
else
|
||||
SubName = prjName.substring(prjName.indexOf('/') + 1);
|
||||
}
|
||||
return SubName;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue