edu.cuhk.hccl.Application.java Source code

Java tutorial

Introduction

Here is the source code for edu.cuhk.hccl.Application.java

Source

/**
 * Copyright (C) 2014 Pengfei Liu <pfliu@se.cuhk.edu.hk>
 * The Chinese University of Hong Kong.
 *
 * This file is part of smart-search-web.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package edu.cuhk.hccl;

import java.io.IOException;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;

import edu.cuhk.hccl.expander.QueryExpander;
import edu.cuhk.hccl.expander.WordNetExpander;
import edu.cuhk.hccl.expander.WordVectorExpander;

@ComponentScan
@EnableAutoConfiguration
public class Application {

    private static final String DATASET_PATH = "data/20-newsgroups";
    private static final String WORDNET_PATH = "wordnet/dict";
    private static final String WORDVECTOR_PATH = "data/google-news/GoogleNews-vectors-negative300.bin.gz";

    public static QueryExpander wordNetExpander = new WordNetExpander(WORDNET_PATH);
    public static QueryExpander wordVectorExpander = new WordVectorExpander(WORDVECTOR_PATH);

    public static void main(String[] args) {

        SpringApplication.run(Application.class, args);

        try {
            Indexer.createIndex(DATASET_PATH);
        } catch (IOException e) {
            System.out.println("Unable to find the dataset: " + DATASET_PATH);
            System.exit(-1);
        }
    }

}