Skip to content

Commit

Permalink
NLP-ENGINE-425 removed io.h from cg.h
Browse files Browse the repository at this point in the history
Signed-off-by: David de Hilster <[email protected]>
  • Loading branch information
ddehilster committed Jul 30, 2024
1 parent ff986bb commit 16627e6
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 104 deletions.
23 changes: 14 additions & 9 deletions cs/libconsh/cg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ All rights reserved.

#include "StdAfx.h"
#include <time.h>
#include <filesystem>
#include "machine-min.h" // 03/08/00 AM.
#include "prim/libprim.h"
#include "lite/global.h"
Expand Down Expand Up @@ -53,7 +54,6 @@ All rights reserved.
#include "cmd.h"
#include "dyn.h" // 06/29/00 AM.
#include "lite/dir.h"
#include "lite/io.h"

#include "prim/unicu.h"
using namespace unicu;
Expand Down Expand Up @@ -3489,18 +3489,16 @@ return word;
CONCEPT *CG::matchDictKB(std::string dictFilename, std::vector<std::filesystem::path> kbfiles) {
if (kbfiles.size() == 0) return NULL;
std::vector<std::filesystem::path>::iterator ptr;

_TCHAR buff[MAXSTR], buffkb[MAXSTR];
_TCHAR *head, *headkb;

CONCEPT *con, *dictcon;
_tcscpy(buff, dictFilename.c_str());
file_head(buff, head);
std::filesystem::path filePath(dictFilename);
std::string head = removeExtension(filePath.filename().string());

for (ptr = kbfiles.begin(); ptr < kbfiles.end(); ptr++) {
_tcscpy(buffkb, ptr->string().c_str());
file_head(buff, headkb);
std::filesystem::path kbpath(ptr->string());
std::string headkb = removeExtension(kbpath.filename().string());

if (!_tcscmp(head,headkb)) {
if (std::strcmp(head.c_str(), headkb.c_str()) == 0) {
con = findRoot();
dictcon = findConcept(con,"dictionary");
if (dictcon) {
Expand All @@ -3511,6 +3509,13 @@ CONCEPT *CG::matchDictKB(std::string dictFilename, std::vector<std::filesystem::
return NULL;
}

std::string CG::removeExtension(const std::string& filename) {
size_t lastDot = filename.find_last_of(".");
if (lastDot == std::string::npos)
return filename;
return filename.substr(0, lastDot);
}

bool CG::openDict(std::vector<std::filesystem::path>& files) {
bool found = false;
files.clear();
Expand Down
1 change: 1 addition & 0 deletions include/Api/consh/cg.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ class LIBCONSH_API CG
CONCEPT *findWordConcept(_TCHAR*); // 06/29/03 AM.

CONCEPT *matchDictKB(std::string dictFilename, std::vector<std::filesystem::path> kbfiles);
std::string removeExtension(const std::string& filename);
bool openDict(std::vector<std::filesystem::path>& files);
bool readDicts(std::vector<std::filesystem::path> files, std::vector<std::filesystem::path> kbfiles);
bool readDict(std::string file, std::vector<std::filesystem::path> kbfiles);
Expand Down
94 changes: 0 additions & 94 deletions include/Api/lite/io.h

This file was deleted.

2 changes: 1 addition & 1 deletion nlp/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ All rights reserved.
#include "lite/nlp_engine.h"
#include "version.h"

#define NLP_ENGINE_VERSION "2.12.2"
#define NLP_ENGINE_VERSION "2.12.3"

bool cmdReadArgs(int,_TCHAR*argv[],_TCHAR*&,_TCHAR*&,_TCHAR*&,_TCHAR*&,bool&,bool&,bool&);
void cmdHelpargs(_TCHAR*);
Expand Down

0 comments on commit 16627e6

Please sign in to comment.