当前位置: 首页>>代码示例>>PHP>>正文


PHP Indexer::get_main_index_pathname方法代码示例

本文整理汇总了PHP中Indexer::get_main_index_pathname方法的典型用法代码示例。如果您正苦于以下问题:PHP Indexer::get_main_index_pathname方法的具体用法?PHP Indexer::get_main_index_pathname怎么用?PHP Indexer::get_main_index_pathname使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Indexer的用法示例。


在下文中一共展示了Indexer::get_main_index_pathname方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: usage

$dir_mes = "in data directory " . $indexer->get_data_root();
if ($csv_filename == null) {
    $mes = "Indexation of all linguistic data files";
} else {
    $mes = "Indexation of the linguistic data file {$csv_filename}";
    $indexer->force_indexation();
}
$logger->info("{$mes} {$dir_mes}\n");
if ($csv_filename != null) {
    $indexer->index_one_file($csv_filename);
    $logger->info("Nb. of morphemes indexed in this pass: " . $indexer->get_nb_indexed_entries());
} else {
    $indexer->index_all_files();
    $logger->info("Total nb. of data files:              " . count($indexer->list_data_files_in_data_directory()));
    $logger->info("Nb. files indexed in this pass: " . $indexer->get_nb_indexed_files());
    $logger->info("Total nb. of entries:              " . count(file($indexer->get_main_index_pathname())));
    $logger->info("Nb. entries indexed in this pass: " . $indexer->get_nb_indexed_entries());
}
function usage($message = null)
{
    if ($message != null) {
        echo "\n*** {$message} ***\n";
    }
    echo "\nUsage: php makeindex.php [-options] [<csv filename>]";
    echo "\n\nwhere options include:";
    echo "\n\n";
    echo "-h\t\tprint this information\n";
    echo "-f\t\tforce indexation\n";
    $indexer = new Indexer();
    echo "-d <dir>\tindex data files in directory <dir> (defaults to " . $indexer->get_data_root() . ")\n";
    echo "\n";
开发者ID:nrc-cnrc,项目名称:InuktitutToolkit,代码行数:31,代码来源:makeIndex.php

示例2: findLinguisticDataInIndex

 public static function findLinguisticDataInIndex($id)
 {
     $logger = Logger::getLogger("LinguisticObjects.findLinguisticDataInIndex");
     $attr_values = null;
     $indexer = new Indexer();
     $index_file = $indexer->get_main_index_pathname();
     $fh = fopen($index_file, 'r');
     while (($ligne = fgets($fh)) != null) {
         list($an_id, $position, $csv_file_name) = explode(':', trim($ligne));
         if ($an_id == $id) {
             $file_name = $indexer->get_data_pathname($csv_file_name);
             $logger->debug("\$file_name= {$file_name}; \$position= {$position}");
             $fih = fopen($file_name, 'r');
             fseek($fih, $position);
             $data = fgets($fih);
             $logger->debug("\$data= {$data}");
             fseek($fih, 0);
             $fields_desc = fgets($fih);
             $logger->debug("\$fields= {$fields_desc}");
             fclose($fih);
             $fieldsValues = parseCSV($fields_desc, $data);
             $attr_values = $fieldsValues;
             break;
         }
     }
     fclose($fh);
     return $attr_values;
 }
开发者ID:nrc-cnrc,项目名称:InuktitutToolkit,代码行数:28,代码来源:LinguisticObjects.php


注:本文中的Indexer::get_main_index_pathname方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。