Skip to content

Commit b0b3cb4

Browse files
committed
config
1 parent 08b715a commit b0b3cb4

File tree

5 files changed

+56
-2
lines changed

5 files changed

+56
-2
lines changed

src/api/Config/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Configuration.php
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
namespace SyntaxTreeApi\Config;
4+
5+
class Configuration extends DefaultConfiguration
6+
{
7+
8+
/**
9+
* Path to TensorFlow`s syntaxnet
10+
* @var string
11+
*/
12+
protected static $syntaxNetPath = '/home/tensor/tensorflow/models/syntaxnet/';
13+
14+
/**
15+
* Path to model for syntaxnet
16+
* @var string
17+
*/
18+
protected static $syntaxNetModelPath = '/home/tensor/tensorflow/Russian-SynTagRus';
19+
20+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace SyntaxTreeApi\Config;
4+
5+
interface ConfigurationInterface
6+
{
7+
8+
public static function getSyntaxNetPath();
9+
10+
public static function getSyntaxNetModelPath();
11+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
namespace SyntaxTreeApi\Config;
4+
5+
class DefaultConfiguration implements ConfigurationInterface
6+
{
7+
8+
protected static $syntaxNetPath;
9+
protected static $syntaxNetModelPath;
10+
11+
public static function getSyntaxNetPath()
12+
{
13+
return static::$syntaxNetPath;
14+
}
15+
16+
public static function getSyntaxNetModelPath()
17+
{
18+
return static::$syntaxNetModelPath;
19+
}
20+
21+
}

src/api/Model/ParseSyntaxCommandFactory.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace SyntaxTreeApi\Model;
44

55
use SyntaxTree\Command\TensorFlowCommand;
6+
use SyntaxTreeApi\Config\Configuration;
67

78
class ParseSyntaxCommandFactory
89
{
@@ -11,7 +12,7 @@ public static function createTensorFlowCommand()
1112
$command = new TensorFlowCommand();
1213

1314
return $command
14-
->setSyntaxnetPath('/home/tensor/tensorflow/models/syntaxnet/')
15-
->setModelPath('/home/tensor/tensorflow/Russian-SynTagRus');
15+
->setSyntaxnetPath(Configuration::getSyntaxNetPath())
16+
->setModelPath(Configuration::getSyntaxNetModelPath());
1617
}
1718
}

0 commit comments

Comments
 (0)