Skip to content

Commit 29e0129

Browse files
committed
-x- option suppresses use of xoptions
1 parent 06cbcdc commit 29e0129

File tree

5 files changed

+39
-21
lines changed

5 files changed

+39
-21
lines changed

Changelog

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
version 3.8 - 2017.02.13
2+
Option -x- suppresses the use of the 'xoptions' file. (Use -x- together with
3+
-p and -n options.)
4+
5+
version 3.7 - 2016.11.09
6+
Enlarged scope of tag_hash.
7+
18
2016.05.17
29

310
Start of changelog.
@@ -16,5 +23,3 @@ The program was not stable if #define STREAM 1 (in defines.h). This is solved.
1623
A lot of commented code and useless comments were removed. There is still a
1724
lot left.
1825

19-
version 3.7 - 2016.11.09
20-
Enlarged scope of tag_hash.

src/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ Version 1: Brill's tagger
33
Version 2: CST's adaptation (standard C, removal of language dependent code, introduction of xoptions, handling of capitals in headlines
44
Version 3: handling of XML (Previously called version 1, because Brill had not defined a version.)
55
*/
6-
#define CSTTAGGERVERSION "3.7"
7-
#define CSTTAGGERDATE "2016.11.09"
6+
#define CSTTAGGERVERSION "3.8"
7+
#define CSTTAGGERDATE "2017.02.13"
88
#define CSTTAGGERCOPYRIGHT "MIT, University of Pennsylvania and Center for Sprogteknologi"
99

1010
#include "useful.h" // dupl

src/option.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ optionStruct::optionStruct():
114114
printf(" -r About redistribution (GNU)\n");
115115
printf(" -W About warranty (GNU)\n");
116116
printf(" -x<path> path to file with extra options (deprecated)\n");
117+
printf(" -x- do not use xoptions file at all\n");
118+
printf(" (Not specifyiing -x makes the tagger look for a file 'xoptions' in the CWD.)\n");
117119
printf(" -f ConvertToLowerCaseIfFirstWord (default off)\n");
118120
printf(" -a ConvertToLowerCaseIfMostWordsAreCapitalized (default off)\n");
119121
printf(" -s ShowIfLowercaseConversionHelped (default off)\n");

src/sst.cpp

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -86,30 +86,37 @@ int start_state_tagger
8686
{
8787
Verbose = Options->Verbose ? 1 : 0;
8888
}
89-
char * tmp;
90-
tmp = coption("Noun");
91-
if(tmp)
89+
90+
if(Options->Noun)
9291
{
93-
strncpy(noun,tmp,sizeof(noun) - 1);
94-
noun[sizeof(noun) - 1] = '\0';
92+
strncpy(noun,Options->Noun,sizeof(noun) - 1);
9593
}
96-
else if(Options->Noun)
94+
else
9795
{
98-
strncpy(noun,Options->Noun,sizeof(noun) - 1);
96+
char * tmp;
97+
tmp = coption("Noun");
98+
if(tmp)
99+
{
100+
strncpy(noun,tmp,sizeof(noun) - 1);
101+
noun[sizeof(noun) - 1] = '\0';
102+
}
99103
}
100104

101-
tmp = coption("Proper");
102-
if(tmp)
105+
if(Options->Proper)
103106
{
104-
strncpy(proper,tmp,sizeof(proper) - 1);
105-
proper[sizeof(proper) - 1] = '\0';
107+
strncpy(proper,Options->Proper,sizeof(noun) - 1);
106108
}
107-
else if(Options->Proper)
109+
else
108110
{
109-
strncpy(proper,Options->Proper,sizeof(noun) - 1);
111+
char * tmp;
112+
tmp = coption("Proper");
113+
if(tmp)
114+
{
115+
strncpy(proper,tmp,sizeof(proper) - 1);
116+
proper[sizeof(proper) - 1] = '\0';
117+
}
110118
}
111119

112-
113120
/***********************************************************************/
114121

115122

src/useful.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,14 @@ int num_words(char *thestr)
8888
return(returncount);
8989
}
9090

91-
static char * getBaseDir()
91+
static char * getXoptionsFile()
9292
{
9393
if(xoptions)
94+
{
95+
if(strcmp(xoptions,"-")) // Bart 20170213 -x- turns off use of xoptions
96+
return NULL;
9497
return xoptions; // Bart 20060321. New option -x <optionfile>
98+
}
9599

96100
// loff
97101
static char basedir[1028];
@@ -118,7 +122,7 @@ static char * getBaseDir()
118122

119123
long option(const char * key)
120124
{
121-
FILE * fp = fopen(getBaseDir(),"r");
125+
FILE * fp = fopen(getXoptionsFile(),"r");
122126
if(fp)
123127
{
124128
char line[256];
@@ -146,7 +150,7 @@ long option(const char * key)
146150
char * coption(const char * key)
147151
{
148152
//loff FILE * fp = fopen("xoptions","r");
149-
FILE * fp = fopen(getBaseDir(),"r");
153+
FILE * fp = fopen(getXoptionsFile(),"r");
150154
if(fp)
151155
{
152156
static /*Bart 20030224*/ char line[256];

0 commit comments

Comments
 (0)