Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
7b6e346
Bumped project to SBT 0.11.3, added bat/shes
melezov Jul 31, 2012
a72210f
refactoring, added lift
Jul 31, 2012
e04765d
refactoring
Jul 31, 2012
ff55164
Fuzzy match of strings, returns 0-1
dstimac Jul 31, 2012
4d81ca3
added package war and changed port as to portmap
Aug 1, 2012
22d1c7c
Name compare api results: yes, no, maybe with calculated diff
dstimac Aug 1, 2012
e3f92e0
Merge github.com:element-doo/name-compare
melezov Aug 1, 2012
410eb53
test example fixed
dstimac Aug 1, 2012
a02b5aa
Moved to code/scala, added shared repository
melezov Aug 1, 2012
9e3b15e
Merge github.com:dstimac/name-compare
melezov Aug 1, 2012
6ffa905
Added .keeps to logs / config.
melezov Aug 1, 2012
c99ebdf
Fixed shared submodule
melezov Aug 1, 2012
238a9e3
Moved web project to to com.instantor.ip.sandbox.
melezov Aug 1, 2012
05fd358
Name comparison refactoring.
melezov Aug 1, 2012
9fc6a7e
Added bouncers / scripts
melezov Aug 2, 2012
88de92a
Fixed all nginx connections (bouncer + shared + generated js / css).
melezov Aug 2, 2012
0215f58
Nginx, Lift setup, HTML, LESS.
Aug 2, 2012
ef89ad5
config promjene
dstimac Aug 2, 2012
0c7d0f4
AJAX submitter, code cleanup.
Aug 2, 2012
58688cc
Merge github.com:elkarrde/name-compare
dstimac Aug 2, 2012
c3f572e
Merge github.com:dstimac/name-compare
Aug 2, 2012
e974d89
Merge github.com:elkarrde/name-compare
dstimac Aug 2, 2012
855c575
Merge github.com:elkarrde/name-compare
Aug 2, 2012
bd31799
JSON!
Aug 2, 2012
2f76466
Merge github.com:elkarrde/name-compare
dstimac Aug 2, 2012
1c417df
added fabric deployment
Aug 2, 2012
ecf885a
host fix
Aug 2, 2012
6903f29
HTML response handler + Coffee error handler
Aug 2, 2012
149e083
forgot shared upload
Aug 2, 2012
4438419
name compare backend logic
dstimac Aug 2, 2012
51d3b4a
out => json object
dstimac Aug 2, 2012
ad15295
Merge github.com:dstimac/name-compare
Aug 2, 2012
a771a35
Merge github.com:dstimac/name-compare
Aug 2, 2012
a2bb8b5
Wrap-up.
Aug 2, 2012
32c1fb4
Merge github.com:element-doo/name-compare
melezov Aug 2, 2012
cc1bfc0
Left no stone unturned; Split projects into separate SBT build config…
melezov Aug 3, 2012
3624853
Moved default tests into resources, added test rememberance in session.
melezov Aug 3, 2012
cc3986c
chmod +x *.sh
melezov Aug 3, 2012
c4526ed
Fixed code paths due to a fault folder move. Set generated scripts / …
melezov Aug 3, 2012
03b4b24
Hyphened names check added
dstimac Aug 3, 2012
385fca7
Added parameter bindings from previous requests.
melezov Aug 3, 2012
1fe4f05
Added parameter bindings from previous requests.
melezov Aug 3, 2012
21efba2
Merge branch 'master' of github.com:instantor/name-compare
melezov Aug 3, 2012
43a5449
Bumped to SBT 0.13.5 & Scala 2.10.4
melezov Jul 7, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
.cache
.classpath
.history
.project
.scala_dependencies
.settings
target
.target

project/strap/sbt-launch-*.jar
*.~

sbt-launch-*.jar

*.log
*.pyc

code/scala/Lift/src/main/static/coffee-js/*.js
code/scala/Lift/src/main/static/less-css/*.css
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "shared"]
path = shared
url = git://github.com/element-doo/shared-static.git
26 changes: 26 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Copyright (c) 2012, Instantor AB
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the Instantor AB nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
14 changes: 8 additions & 6 deletions README
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@

FUZZY STRING MATCHING

NAME COMPARISON PROJECT

* FuzzyMatch.apply is a method for comparing 2 names, that uses Levenshtein algorithm.
* The Levenshtein algorithm (also called Edit-Distance) calculates the
* least number of edit operations that are necessary to modify one string to obtain another string.
* least number of edit operations that are necessary to modify one string to become an another string.
*
* Method FuzzyMatch.apply returns 0 to 1 correlation between 2 names.
*
Expand All @@ -13,6 +12,9 @@
* 1. Transliterated
* 2. Alphabetically sorted
* 3. Converted to lowercase and trimmed for extra whitespaces



*
* Additionally, specialised handlers have been created for special cases of names
* containing hyphens or names which have been shortened to initials.
*
* A live demo of this code is available on the Instantor sandbox server at:
* https://platform.instantor.com/sandbox/name-compare/
35 changes: 0 additions & 35 deletions build.sbt

This file was deleted.

40 changes: 40 additions & 0 deletions code/scala/Core/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name := "Name-Compare"

version := "0.1.1-3"

organization := "hr.element.etb"

crossScalaVersions := Seq("2.10.4", "2.9.2", "2.9.1-1", "2.9.1", "2.9.0-1", "2.9.0")

scalaVersion := crossScalaVersions.value.head

scalacOptions := Seq("-unchecked", "-deprecation", "-encoding", "UTF-8", "-optimise")

unmanagedSourceDirectories in Compile := Seq((scalaSource in Compile).value)

unmanagedSourceDirectories in Test := Seq((scalaSource in Test).value)

resolvers := Seq("Element Nexus" at "http://repo.element.hr/nexus/content/groups/public/")

externalResolvers <<= resolvers map ( rs =>
Resolver.withDefaultResolvers(rs, mavenCentral = false)
)

libraryDependencies := Seq(
"com.ibm.icu" % "icu4j" % "49.1"
, "uk.ac.shef.wit" % "simmetrics" % "1.6.2"
, "org.scalatest" %% "scalatest" % "2.0" % "test"
)

publishTo <<= (version) ( v => Some(
if (v endsWith "SNAPSHOT") {
"Element Snapshots" at "http://repo.element.hr/nexus/content/repositories/snapshots/"
}
else {
"Element Releases" at "http://repo.element.hr/nexus/content/repositories/releases/"
}
))

credentials += Credentials(Path.userHome / ".publish" / "element.credentials")

publishArtifact in (Compile, packageDoc) := false
4 changes: 4 additions & 0 deletions code/scala/Core/continuous-compilation.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@echo off

echo Entering continuous compilation loop ...
call "%~dp0\sbt.bat" --loop --no-jrebel %* ~compile
4 changes: 4 additions & 0 deletions code/scala/Core/continuous-compilation.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

echo Entering continuous compilation loop ...
`dirname $0`/sbt.sh --loop --no-jrebel "$@" ~compile
4 changes: 4 additions & 0 deletions code/scala/Core/cross-publish.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@echo off

echo Will cross-publish project to the maven server
call "%~dp0sbt.bat" %* clean +publish
4 changes: 4 additions & 0 deletions code/scala/Core/cross-publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

echo Will cross-publish project to the maven server
`dirname $0`/sbt.sh --no-jrebel "$@" clean +publish
4 changes: 4 additions & 0 deletions code/scala/Core/open-console.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@echo off

echo Firing up the Scala REPL ...
call "%~dp0\sbt.bat" %* console
4 changes: 4 additions & 0 deletions code/scala/Core/open-console.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

echo Firing up the Scala REPL ...
`dirname $0`/sbt.sh "$@" console
5 changes: 5 additions & 0 deletions code/scala/Core/prepare-workspace.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@echo off

echo Performing dependency update for all projects ...
echo Will also create Eclipse .project and .classpath files ...
call "%~dp0\sbt.bat" --no-jrebel %* update eclipse
5 changes: 5 additions & 0 deletions code/scala/Core/prepare-workspace.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

echo Performing dependency update for all projects ...
echo Will also create Eclipse .project and .classpath files ...
`dirname $0`/sbt.sh --no-jrebel "$@" update eclipse
1 change: 1 addition & 0 deletions code/scala/Core/project/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sbt.version=0.13.5
23 changes: 13 additions & 10 deletions project/plugins.sbt → code/scala/Core/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
resolvers := Seq(
"Element Nexus" at "http://repo.element.hr/nexus/content/groups/public/"
, Resolver.url("Element Nexus (Ivy)", url("http://repo.element.hr/nexus/content/groups/public/"))(Resolver.ivyStylePatterns)
)

externalResolvers := Resolver.withDefaultResolvers(resolvers.value, mavenCentral = false)

// =======================================================================================

// +-------------------------------------------------------------------------------------+
// | SBT Eclipse (https://github.com/typesafehub/sbteclipse) |
// | Creates .project and .classpath files for easy Eclipse project imports |
Expand All @@ -6,17 +15,11 @@
// | See also: Scala IDE downloads (http://download.scala-ide.org/) |
// +-------------------------------------------------------------------------------------+

resolvers += Classpaths.typesafeResolver

addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.0.0")
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.5.0")

// +-------------------------------------------------------------------------------------+
// | SBT Scalariform (https://github.com/typesafehub/sbtscalariform) |
// | Performs source code formatting |
// | |
// | See also: Scalariform reference (http://mdr.github.com/scalariform/) |
// | Dependency graph SBT plugin (https://github.com/jrudolph/sbt-dependency-graph) |
// | Lists all library dependencies in a nicely formatted way for easy inspection. |
// +-------------------------------------------------------------------------------------+

resolvers += Classpaths.typesafeResolver

addSbtPlugin("com.typesafe.sbtscalariform" % "sbtscalariform" % "0.3.0")
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.7.4")
Binary file not shown.
28 changes: 28 additions & 0 deletions code/scala/Core/project/strap/sbt.boot.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[scala]
version: ${sbt.scala.version-auto}

[app]
org: ${sbt.organization-org.scala-sbt}
name: sbt
version: ${sbt.version-read(sbt.version)[0.13.5]}
class: ${sbt.main.class-sbt.xMain}
components: xsbti,extra
cross-versioned: ${sbt.cross.versioned-false}
resources: ${sbt.extraClasspath-}

[repositories]
local
element-nexus: http://maven.element.hr/nexus/content/groups/public/
element-nexus-ivy: http://maven.element.hr/nexus/content/groups/public/, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext]

[boot]
directory: ${sbt.boot.directory-${sbt.global.base-${user.home}/.sbt}/boot/}

[ivy]
ivy-home: ${sbt.ivy.home-${user.home}/.ivy2/name-compare}
checksums: ${sbt.checksums-sha1,md5}
override-build-repos: ${sbt.override.build.repos-false}
repository-config: ${sbt.repository.config-${sbt.global.base-${user.home}/.sbt}/repositories}

[log]
level: info
75 changes: 75 additions & 0 deletions code/scala/Core/sbt.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
@echo off
setlocal
pushd
cd "%~dp0"

set JVM_PARAMS=-Xss2m -Xmx712m -XX:MaxPermSize=256m -XX:+CMSClassUnloadingEnabled

set LIFT_RUN_MODE=-Drun.mode=development
set TRY_JREBEL=true
set LOG_LEVEL=
set NO_PAUSE=false
set DO_LOOP=false

:PARSER_LOOP
if "%~1"=="" goto :PARSER_END

if "%~1"=="--prod" (
set LIFT_RUN_MODE=-Drun.mode=production
goto :PARSER_CONTINUE
)

if "%~1"=="--debug" (
set LOG_LEVEL="set logLevel:=Level.Debug"
goto :PARSER_CONTINUE
)

if "%~1"=="~lift" (
set SBT_PARAMS=%SBT_PARAMS% container:start ~compile container:stop
set JREBEL_PLUGINS=%JREBEL_PLUGINS% -Drebel.lift_plugin=true
goto :PARSER_CONTINUE
)

if "%~1"=="--no-jrebel" (
set TRY_JREBEL=false
goto :PARSER_CONTINUE
)

if "%~1"=="--loop" (
set DO_LOOP=true
goto :PARSER_CONTINUE
)

if "%~1"=="--no-pause" (
set NO_PAUSE=true
goto :PARSER_CONTINUE
)

set SBT_PARAMS=%SBT_PARAMS% %1

:PARSER_CONTINUE
shift
goto :PARSER_LOOP
:PARSER_END

set JVM_PARAMS=%JVM_PARAMS% %LIFT_RUN_MODE%
if %TRY_JREBEL%.==true. (
if exist "%JREBEL_HOME%\jrebel.jar" set JVM_PARAMS=%JVM_PARAMS% -noverify -javaagent:"%JREBEL_HOME%\jrebel.jar" %JREBEL_PLUGINS%
)

set GRUJ_PATH=project\strap\gruj_vs_sbt-launch-0.13.x.jar
set RUN_CMD=java %JVM_PARAMS% -jar %GRUJ_PATH% %LOG_LEVEL% %SBT_PARAMS%

:RUN_LOOP
%RUN_CMD%

if %DO_LOOP%.==true. (
if %NO_PAUSE%.==false. (
echo Press Enter to continue or Press CTRL+C to exit!
pause
)
goto :RUN_LOOP
)

popd
endlocal
4 changes: 2 additions & 2 deletions sbt.sh → code/scala/Core/sbt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
cd `dirname $0`

## START JVM PARAMS
JVM_PARAMS="-Xss2m -Xmx1g -XX:MaxPermSize=256m -XX:+CMSClassUnloadingEnabled"
JVM_PARAMS="-Xss2m -Xmx712m -XX:MaxPermSize=256m -XX:+CMSClassUnloadingEnabled"

LIFT_RUN_MODE="-Drun.mode=development"
TRY_JREBEL=true
Expand Down Expand Up @@ -51,7 +51,7 @@ if $TRY_JREBEL && [ -n "$JREBEL_HOME" ] && [ -f $JREBEL_HOME/jrebel.jar ]; then
JVM_PARAMS="$JVM_PARAMS -noverify -javaagent:$JREBEL_HOME/jrebel.jar $JREBEL_PLUGINS"
fi

GRUJ_PATH="project/strap/gruj_vs_sbt-launch-0.11.2.jar"
GRUJ_PATH="project/strap/gruj_vs_sbt-launch-0.13.x.jar"
RUN_CMD="java $JVM_PARAMS -jar $GRUJ_PATH $LOG_LEVEL $SBT_PARAMS"

LOOPING=true
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package hr.element.etb.name_compare

sealed abstract class ComparisonDecision(
val decision: String
, val isOk: Boolean
, val description: String
, val percentage: Float) {

override val toString = "%s (%s: %.0f%%)" format(
decision
, description
, percentage * 100
)
}

case object IdenticalMatch
extends ComparisonDecision("Yes", true, "Identical match", 1f)

case class DirectMatch(override val percentage: Float)
extends ComparisonDecision("Yes", true, "There was a direct match", percentage)

case class InitialsMatch(override val percentage: Float)
extends ComparisonDecision("Maybe", true, "There was a match via initials", percentage)

case class HyphenMatch(override val percentage: Float)
extends ComparisonDecision("Maybe", true, "There was a match via hyphens", percentage)

case class NoMatch(override val percentage: Float)
extends ComparisonDecision("No", false, "There was no match", percentage)

case object MatchError
extends ComparisonDecision("No", false, "There was an error", 0f)
Loading