@@ -236,24 +236,32 @@ private void CheckSettings()
236
236
237
237
private void SetTFeatures ( )
238
238
{
239
- //Load template feature set
240
- var tfeatureFilePath = GetFilePath ( currentDirectory , config . GetValueRequired ( TFEATURE_FILENAME ) ) ;
241
- Logger . WriteLine ( $ "Loading template feature set from { tfeatureFilePath } ") ;
242
- tFeaturizer = new TemplateFeaturizer ( tfeatureFilePath ) ;
243
-
244
- var tfeatureWeightType = config . GetValueRequired ( TFEATURE_WEIGHT_TYPE ) ;
245
- tFeatureWeightType = tfeatureWeightType . Equals ( "binary" , StringComparison . InvariantCultureIgnoreCase )
246
- ? TFEATURE_WEIGHT_TYPE_ENUM . BINARY
247
- : TFEATURE_WEIGHT_TYPE_ENUM . FREQUENCY ;
248
- Logger . WriteLine ( $ "TFeature weight type: { tfeatureWeightType } ") ;
249
-
250
- var tfeatureContext = config . GetValueRequired ( TFEATURE_CONTEXT ) ;
251
- featureContext . Add ( TFEATURE_CONTEXT , new List < int > ( ) ) ;
252
- foreach ( var contextOffset in tfeatureContext . Split ( ',' ) )
239
+ string tfeatureFileName = config . GetValueOptional ( TFEATURE_FILENAME ) ;
240
+ if ( String . IsNullOrEmpty ( tfeatureFileName ) == false )
253
241
{
254
- featureContext [ TFEATURE_CONTEXT ] . Add ( int . Parse ( contextOffset ) ) ;
242
+ //Load template feature set
243
+ var tfeatureFilePath = GetFilePath ( currentDirectory , tfeatureFileName ) ;
244
+ Logger . WriteLine ( $ "Loading template feature set from { tfeatureFilePath } ") ;
245
+ tFeaturizer = new TemplateFeaturizer ( tfeatureFilePath ) ;
246
+
247
+ var tfeatureWeightType = config . GetValueRequired ( TFEATURE_WEIGHT_TYPE ) ;
248
+ tFeatureWeightType = tfeatureWeightType . Equals ( "binary" , StringComparison . InvariantCultureIgnoreCase )
249
+ ? TFEATURE_WEIGHT_TYPE_ENUM . BINARY
250
+ : TFEATURE_WEIGHT_TYPE_ENUM . FREQUENCY ;
251
+ Logger . WriteLine ( $ "TFeature weight type: { tfeatureWeightType } ") ;
252
+
253
+ var tfeatureContext = config . GetValueRequired ( TFEATURE_CONTEXT ) ;
254
+ featureContext . Add ( TFEATURE_CONTEXT , new List < int > ( ) ) ;
255
+ foreach ( var contextOffset in tfeatureContext . Split ( ',' ) )
256
+ {
257
+ featureContext [ TFEATURE_CONTEXT ] . Add ( int . Parse ( contextOffset ) ) ;
258
+ }
259
+ Logger . WriteLine ( $ "TFeature context: { tfeatureContext } ") ;
260
+ }
261
+ else
262
+ {
263
+ Logger . WriteLine ( $ "No TFeature available.") ;
255
264
}
256
- Logger . WriteLine ( $ "TFeature context: { tfeatureContext } ") ;
257
265
}
258
266
259
267
private void SetPretrainedModel ( )
0 commit comments